v0.21.0
- Dynamically insert handlers πͺ Fixes #376.
- Add context to WebSocket. This allows one to use
HTTP::Server::Context
inws
declarations π Fixes #349.
ws "/:room_name" do |socket, env|
env.params.url["room_name"]
end
- Add support for customizing the headers of built-in
Kemal::StaticFileHandler
π¨ Useful for supportingCORS
for single page applications π
static_headers do |response, filepath, filestat|
if filepath =~ /\.html$/
response.headers.add("Access-Control-Allow-Origin", "*")
end
response.headers.add("Content-Size", filestat.size.to_s)
end
end
-
Security: X-Content-Type-Options: nosniff for static files. Fixes #379. Thanks @crisward π
-
Performance: Remove tempfile management to OS. This brings %10 - 15 performance boost to Kemal π