kemal/spec/frank_handler_spec.cr
Zamith 8cf04b58ca
Move static file handler to be called after the instance handler
This way only routes that are not caught by the instance handler will go
through to the static file handler.
2015-01-31 14:39:50 +00:00

23 lines
597 B
Crystal

require "./spec_helper"
describe "Frank::Handler" do
it "routes" do
frank = Frank::Handler.new
frank.add_route "GET", "/" do
"hello"
end
request = HTTP::Request.new("GET", "/")
response = frank.call(request)
response.body.should eq("hello")
end
it "sets content type" do
frank = Frank::Handler.new
frank.add_route "GET", "/" do |env|
env.response.content_type = "application/json"
end
request = HTTP::Request.new("GET", "/")
response = frank.call(request)
response.headers["Content-Type"].should eq("application/json")
end
end