mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Remove merged params to improve performance
This commit is contained in:
parent
53d12534b7
commit
42deb95688
3 changed files with 3 additions and 7 deletions
|
@ -170,8 +170,8 @@ describe "Kemal::RouteHandler" do
|
||||||
request = HTTP::Request.new(
|
request = HTTP::Request.new(
|
||||||
"POST",
|
"POST",
|
||||||
"/",
|
"/",
|
||||||
body: json_payload.to_json,
|
body: "_method=DELETE",
|
||||||
headers: HTTP::Headers{"Content-Type": "application/json"}
|
headers: HTTP::Headers{"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}
|
||||||
)
|
)
|
||||||
io_with_context = create_request_and_return_io(kemal, request)
|
io_with_context = create_request_and_return_io(kemal, request)
|
||||||
client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
|
client_response = HTTP::Client::Response.from_io(io_with_context, decompress: false)
|
||||||
|
|
|
@ -23,10 +23,6 @@ class Kemal::ParamParser
|
||||||
parse_request
|
parse_request
|
||||||
end
|
end
|
||||||
|
|
||||||
def params
|
|
||||||
@query.merge(@body).merge(@json).merge(@url)
|
|
||||||
end
|
|
||||||
|
|
||||||
def parse_request
|
def parse_request
|
||||||
parse_query
|
parse_query
|
||||||
parse_body
|
parse_body
|
||||||
|
|
|
@ -11,7 +11,7 @@ class HTTP::Request
|
||||||
private def check_for_method_override!
|
private def check_for_method_override!
|
||||||
@override_method = @method
|
@override_method = @method
|
||||||
if @method == "POST"
|
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"])
|
if params.has_key?("_method") && HTTP::Request.override_method_valid?(params["_method"])
|
||||||
@override_method = params["_method"]
|
@override_method = params["_method"]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue