]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs(encoding): add comment about plus character
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 6 Oct 2020 12:26:17 +0000 (14:26 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 6 Oct 2020 12:26:17 +0000 (14:26 +0200)
src/encoding.ts

index 2c2df76a72f8b9d88fe1af1ac9caa4bb750fe08c..8d1a66028a0870b39918c1c35d2a9e0636143d4d 100644 (file)
@@ -23,6 +23,21 @@ const AMPERSAND_RE = /&/g // %26
 const SLASH_RE = /\//g // %2F
 const EQUAL_RE = /=/g // %3D
 const IM_RE = /\?/g // %3F
+/**
+ * NOTE: It's not clear to me if we should encode the + symbol in queries, it
+ * seems to be less flexible than not doing so and I can't find out the legacy
+ * systems requiring this for regular requests like text/html. In the standard,
+ * the encoding of the plus character is only mentioned for
+ * application/x-www-form-urlencoded
+ * (https://url.spec.whatwg.org/#urlencoded-parsing) and most browsers seems lo
+ * leave the plus character as is in queries. To be more flexible, we allow the
+ * plus character on the query but it can also be manually encoded by the user.
+ *
+ * Resources:
+ * - https://url.spec.whatwg.org/#urlencoded-parsing
+ * - https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
+ */
+// const PLUS_RE = /\+/g // %3F
 
 const ENC_BRACKET_OPEN_RE = /%5B/g // [
 const ENC_BRACKET_CLOSE_RE = /%5D/g // ]