mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Fix basic_auth
This commit is contained in:
parent
2c95fa560d
commit
211685ee74
2 changed files with 5 additions and 1 deletions
|
@ -23,7 +23,7 @@ end
|
|||
|
||||
# Uses Kemal::Middleware::HTTPBasicAuth to easily add HTTP Basic Auth support.
|
||||
macro basic_auth(username, password)
|
||||
auth_handler = Kemal::Middleware::HTTPBasicAuth.new("serdar", "123")
|
||||
auth_handler = Kemal::Middleware::HTTPBasicAuth.new(username, password)
|
||||
Kemal.config.add_handler auth_handler
|
||||
end
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ class Kemal::ParamParser
|
|||
parse_part(@request.query)
|
||||
end
|
||||
|
||||
# Parses JSON request body if Content-Type is `application/json`.
|
||||
# If request body is a JSON Hash then all the params are parsed and added into `params`.
|
||||
# If request body is a JSON Array it's added into `params` as `_json` and can be accessed
|
||||
# like params["_json"]
|
||||
def parse_json
|
||||
return unless @request.body && @request.headers["Content-Type"]? == APPLICATION_JSON
|
||||
|
||||
|
|
Loading…
Reference in a new issue