mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Modiy HTTP::Params.[] to fetch all params (#328)
This commit is contained in:
parent
d0c034b911
commit
1177619da9
3 changed files with 88 additions and 98 deletions
8
src/kemal/ext/params.cr
Normal file
8
src/kemal/ext/params.cr
Normal file
|
@ -0,0 +1,8 @@
|
|||
module HTTP
|
||||
struct Params
|
||||
def [](name)
|
||||
params = raw_params[name]
|
||||
params.size == 1 ? params.first : params
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class HTTP::Request
|
||||
property override_method
|
||||
property override_method : String?
|
||||
property url_params : Hash(String, String)?
|
||||
getter param_parser : Kemal::ParamParser?
|
||||
|
||||
|
@ -21,7 +21,7 @@ class HTTP::Request
|
|||
@param_parser = Kemal::ParamParser.new(self)
|
||||
params = @param_parser.not_nil!.body
|
||||
if params.has_key?("_method") && HTTP::Request.override_method_valid?(params["_method"])
|
||||
@override_method = params["_method"]
|
||||
@override_method = params["_method"].as(String)
|
||||
end
|
||||
end
|
||||
@override_method
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue