From 42deb956882127e90c2c1e653efcbff05aea6c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Kadir=20Ak=C4=B1n?= Date: Sun, 6 Mar 2016 21:46:35 +0200 Subject: [PATCH] Remove merged params to improve performance --- spec/route_handler_spec.cr | 4 ++-- src/kemal/param_parser.cr | 4 ---- src/kemal/request.cr | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/spec/route_handler_spec.cr b/spec/route_handler_spec.cr index 69e742a..6d21334 100644 --- a/spec/route_handler_spec.cr +++ b/spec/route_handler_spec.cr @@ -170,8 +170,8 @@ describe "Kemal::RouteHandler" do request = HTTP::Request.new( "POST", "/", - body: json_payload.to_json, - headers: HTTP::Headers{"Content-Type": "application/json"} + body: "_method=DELETE", + headers: HTTP::Headers{"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} ) io_with_context = create_request_and_return_io(kemal, request) client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false) diff --git a/src/kemal/param_parser.cr b/src/kemal/param_parser.cr index 48e97f8..c383689 100644 --- a/src/kemal/param_parser.cr +++ b/src/kemal/param_parser.cr @@ -23,10 +23,6 @@ class Kemal::ParamParser parse_request end - def params - @query.merge(@body).merge(@json).merge(@url) - end - def parse_request parse_query parse_body diff --git a/src/kemal/request.cr b/src/kemal/request.cr index 92317c2..60dc1cd 100644 --- a/src/kemal/request.cr +++ b/src/kemal/request.cr @@ -11,7 +11,7 @@ class HTTP::Request private def check_for_method_override! @override_method = @method if @method == "POST" - params = Kemal::ParamParser.new(self).params + params = Kemal::ParamParser.new(self).body if params.has_key?("_method") && HTTP::Request.override_method_valid?(params["_method"]) @override_method = params["_method"] end