Use context instead of response in static_headers helper (#681)

This commit is contained in:
Serdar Dogruyol - Sedo セド 2024-05-10 18:47:27 +03:00 committed by GitHub
parent e69bd400b7
commit 6a29240bbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View file

@ -141,11 +141,11 @@ describe Kemal::StaticFileHandler do
end
it "should handle setting custom headers" do
headers = Proc(HTTP::Server::Response, String, File::Info, Void).new do |response, path, stat|
headers = Proc(HTTP::Server::Context, String, File::Info, Void).new do |env, path, stat|
if path =~ /\.html$/
response.headers.add("Access-Control-Allow-Origin", "*")
env.response.headers.add("Access-Control-Allow-Origin", "*")
end
response.headers.add("Content-Size", stat.size.to_s)
env.response.headers.add("Content-Size", stat.size.to_s)
end
static_headers(&headers)