X-Git-Url: http://nitlanguage.org diff --git a/lib/nitcorn/http_request.nit b/lib/nitcorn/http_request.nit index 4cda1a8..f1135a5 100644 --- a/lib/nitcorn/http_request.nit +++ b/lib/nitcorn/http_request.nit @@ -76,13 +76,13 @@ class HttpRequest return s end - # Returns argument `arg_name` as an Int or `null` if not found or not a number. + # Returns argument `arg_name` as an Int or `null` if not found or not an integer. # # NOTE: Prioritizes POST before GET fun int_arg(arg_name: String): nullable Int do if not all_args.has_key(arg_name) then return null var i = all_args[arg_name] - if not i.is_numeric then return null + if not i.is_int then return null return i.to_i end @@ -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