Merge: nitcorn: decode GET args from percent encoding
[nit.git] / lib / nitcorn / http_request.nit
index ff8d58d..3894eb7 100644 (file)
@@ -146,7 +146,7 @@ class HttpRequestParser
                end
 
                # POST args
-               if http_request.method == "POST" then
+               if http_request.method == "POST" or http_request.method == "PUT" then
                        http_request.body = body
                        var lines = body.split_with('&')
                        for line in lines do if not line.trim.is_empty then
@@ -239,7 +239,10 @@ class HttpRequestParser
                        for param in get_args do
                                var key_value = param.split_with("=")
                                if key_value.length < 2 then continue
-                               query_strings[key_value[0]] = key_value[1]
+
+                               var key = key_value[0].from_percent_encoding
+                               var value = key_value[1].from_percent_encoding
+                               query_strings[key] = value
                        end
                end