about summary refs log tree commit diff stats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-30 03:35:11 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-30 03:36:37 +0200
commit8f20dc084112fdc605ce52adadcbb733da6ddd0f (patch)
tree8ca32feee9f800b817e34d380693004c1ee15119 /src/types
parent8048a943706ee32f5970e461dda0a01aeb55c27f (diff)
downloadchawan-8f20dc084112fdc605ce52adadcbb733da6ddd0f.tar.gz
buffer: improve submitForm
* add handlers for javascript, mailto
* HTTP-like behavior for unknown protocols
Diffstat (limited to 'src/types')
-rw-r--r--src/types/url.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/types/url.nim b/src/types/url.nim
index 10100ee1..ac83538e 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -886,15 +886,15 @@ proc parseApplicationXWWWFormUrlEncoded(input: string): seq[(string, string)] =
     result.add((percentDecode(name), percentDecode(value)))
 
 #https://url.spec.whatwg.org/#concept-urlencoded-serializer
-proc serializeApplicationXWWWFormUrlEncoded*(kvs: seq[(string, string)]):
-    string =
+proc serializeApplicationXWWWFormUrlEncoded*(kvs: seq[(string, string)],
+    spaceAsPlus = true): string =
   for it in kvs:
     let (name, value) = it
     if result != "":
       result &= '&'
-    result.percentEncode(name, ApplicationXWWWFormUrlEncodedSet, true)
+    result.percentEncode(name, ApplicationXWWWFormUrlEncodedSet, spaceAsPlus)
     result &= '='
-    result.percentEncode(value, ApplicationXWWWFormUrlEncodedSet, true)
+    result.percentEncode(value, ApplicationXWWWFormUrlEncodedSet, spaceAsPlus)
 
 proc initURLSearchParams(params: URLSearchParams, init: string) =
   params.list = parseApplicationXWWWFormUrlEncoded(init)