Skip to content

Commit

Permalink
Add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Apr 3, 2024
1 parent 3f6a421 commit 7858fd6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/init_handler_spec.cr
Expand Up @@ -11,6 +11,17 @@ describe "Kemal::InitHandler" do
context.response.headers["Content-Type"].should eq "text/html"
end

it "initializes context with Date header" do
request = HTTP::Request.new("GET", "/")
io = IO::Memory.new
response = HTTP::Server::Response.new(io)
context = HTTP::Server::Context.new(request, response)
Kemal::InitHandler::INSTANCE.next = ->(_context : HTTP::Server::Context) {}
Kemal::InitHandler::INSTANCE.call(context)
date = context.response.headers["Date"]?.should_not be_nil
Time.parse_rfc2822(date).should be_close(Time.utc, 1.second)
end

it "initializes context with X-Powered-By: Kemal" do
request = HTTP::Request.new("GET", "/")
io = IO::Memory.new
Expand Down

0 comments on commit 7858fd6

Please sign in to comment.