Compare commits
4 commits
1a8894eece
...
dc548fcb83
Author | SHA1 | Date | |
---|---|---|---|
dc548fcb83 | |||
|
15022c25b8 | ||
|
e99129ab50 | ||
|
ff3b28c6f7 |
4 changed files with 28 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
# 0.26.0 (05-08-2019)
|
||||||
|
|
||||||
|
- Crystal 0.30.0 support :tada: [#548](https://github.com/kemalcr/kemal/pull/548) and [#544](https://github.com/kemalcr/kemal/pull/544). Thanks @bcardiff and @straight-shoota :pray:
|
||||||
|
- Add support for serving files greater than 2^31 bytes [#546](https://github.com/kemalcr/kemal/pull/546). Thanks @omarroth :pray:
|
||||||
|
- Properly measure request time using `Time.monotonic` [#527](https://github.com/kemalcr/kemal/pull/527). Thanks @spinscale :pray:
|
||||||
|
|
||||||
# 0.25.2 (08-02-2019)
|
# 0.25.2 (08-02-2019)
|
||||||
|
|
||||||
- Add option to config to parse or not command line parameters [#483](https://github.com/kemalcr/kemal/pull/483). Thanks @diegogub :pray:
|
- Add option to config to parse or not command line parameters [#483](https://github.com/kemalcr/kemal/pull/483). Thanks @diegogub :pray:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: kemal
|
name: kemal
|
||||||
version: 0.25.2
|
version: 0.26.0
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Serdar Dogruyol <dogruyolserdar@gmail.com>
|
- Serdar Dogruyol <dogruyolserdar@gmail.com>
|
||||||
|
@ -17,9 +17,9 @@ dependencies:
|
||||||
|
|
||||||
development_dependencies:
|
development_dependencies:
|
||||||
ameba:
|
ameba:
|
||||||
github: veelenga/ameba
|
github: crystal-ameba/ameba
|
||||||
version: ~> 0.10.0
|
version: ~> 0.10.0
|
||||||
|
|
||||||
crystal: 0.27.2
|
crystal: 0.30.0
|
||||||
|
|
||||||
license: MIT
|
license: MIT
|
||||||
|
|
|
@ -63,6 +63,24 @@ describe "Macros" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#callbacks" do
|
||||||
|
it "can break block with halt macro from before_* callback" do
|
||||||
|
filter_middleware = Kemal::FilterHandler.new
|
||||||
|
filter_middleware._add_route_filter("GET", "/", :before) do |env|
|
||||||
|
halt env, status_code: 400, response: "Missing origin."
|
||||||
|
end
|
||||||
|
|
||||||
|
get "/" do |env|
|
||||||
|
"Hello world"
|
||||||
|
end
|
||||||
|
|
||||||
|
request = HTTP::Request.new("GET", "/")
|
||||||
|
client_response = call_request_on_app(request)
|
||||||
|
client_response.status_code.should eq(400)
|
||||||
|
client_response.body.should eq("Missing origin.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#headers" do
|
describe "#headers" do
|
||||||
it "can add headers" do
|
it "can add headers" do
|
||||||
get "/headers" do |env|
|
get "/headers" do |env|
|
||||||
|
|
|
@ -45,6 +45,7 @@ module Kemal
|
||||||
# Processes the route if it's a match. Otherwise renders 404.
|
# Processes the route if it's a match. Otherwise renders 404.
|
||||||
private def process_request(context)
|
private def process_request(context)
|
||||||
raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_found?
|
raise Kemal::Exceptions::RouteNotFound.new(context) unless context.route_found?
|
||||||
|
return if context.response.closed?
|
||||||
content = context.route.handler.call(context)
|
content = context.route.handler.call(context)
|
||||||
|
|
||||||
if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(context.response.status_code)
|
if !Kemal.config.error_handlers.empty? && Kemal.config.error_handlers.has_key?(context.response.status_code)
|
||||||
|
|
Loading…
Reference in a new issue