From 8e18f5ab503d9c6fc1a893c14af3771b7d50fbb3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 28 Jul 2014 09:36:25 -0400 Subject: [PATCH] lib/nitcorn: intro `HttpRequest::all_args` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/nitcorn/http_request.nit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/nitcorn/http_request.nit b/lib/nitcorn/http_request.nit index 1a49e0c..07b91ad 100644 --- a/lib/nitcorn/http_request.nit +++ b/lib/nitcorn/http_request.nit @@ -54,6 +54,9 @@ class HttpRequest # The arguments passed with the POST method var post_args = new HashMap[String, String] + + # The arguments passed with the POST or GET method (with a priority on POST) + var all_args = new HashMap[String, String] end # Utility class to parse a request string and build a `HttpRequest` @@ -96,7 +99,10 @@ class HttpRequestParser if http_request.url.has('?') then http_request.uri = first_line[1].substring(0, first_line[1].index_of('?')) http_request.query_string = first_line[1].substring_from(first_line[1].index_of('?')+1) + + var parse_url = parse_url http_request.get_args = parse_url + http_request.all_args.recover_with parse_url else http_request.uri = first_line[1] end @@ -113,6 +119,7 @@ class HttpRequestParser continue end http_request.post_args[parts[0]] = decoded + http_request.all_args[parts[0]] = decoded else print "POST Error: {line} format error on {line}" end -- 1.7.9.5