mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Middleware ordering (#236)
Improve and correct request middleware Request -> Middleware -> Filter -> Route
This commit is contained in:
parent
1b27f5c011
commit
922d6de4d1
6 changed files with 79 additions and 24 deletions
|
@ -30,7 +30,7 @@ describe "Macros" do
|
|||
it "sets a custom logger" do
|
||||
config = Kemal::Config::INSTANCE
|
||||
logger CustomLogHandler.new
|
||||
config.handlers.last.should be_a(CustomLogHandler)
|
||||
config.handlers[4].should be_a(CustomLogHandler)
|
||||
config.logger.should be_a(CustomLogHandler)
|
||||
end
|
||||
end
|
||||
|
@ -77,7 +77,6 @@ describe "Macros" do
|
|||
"Content-Type" => "text/plain",
|
||||
}
|
||||
end
|
||||
|
||||
request = HTTP::Request.new("GET", "/headers")
|
||||
response = call_request_on_app(request)
|
||||
response.headers["Access-Control-Allow-Origin"].should eq("*")
|
||||
|
@ -126,11 +125,7 @@ describe "Macros" do
|
|||
describe "#gzip" do
|
||||
it "adds HTTP::DeflateHandler to handlers" do
|
||||
gzip true
|
||||
Kemal.config.handlers.last.is_a?(HTTP::DeflateHandler).should eq true
|
||||
end
|
||||
|
||||
it "doesn't add HTTP::DeflateHandler to handlers by default" do
|
||||
Kemal.config.handlers.last.is_a?(HTTP::DeflateHandler).should eq false
|
||||
Kemal.config.handlers[4].should be_a(HTTP::DeflateHandler)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue