Remove merged params to improve performance

This commit is contained in:
Fatih Kadir Akın 2016-03-06 21:46:35 +02:00
parent 53d12534b7
commit 42deb95688
3 changed files with 3 additions and 7 deletions

View file

@ -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)

View file

@ -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

View file

@ -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