mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Add specs
This commit is contained in:
parent
3f6a4216d4
commit
7858fd6334
1 changed files with 11 additions and 0 deletions
|
@ -11,6 +11,17 @@ describe "Kemal::InitHandler" do
|
||||||
context.response.headers["Content-Type"].should eq "text/html"
|
context.response.headers["Content-Type"].should eq "text/html"
|
||||||
end
|
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
|
it "initializes context with X-Powered-By: Kemal" do
|
||||||
request = HTTP::Request.new("GET", "/")
|
request = HTTP::Request.new("GET", "/")
|
||||||
io = IO::Memory.new
|
io = IO::Memory.new
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue