@sdogruyol sdogruyol released this Sep 5, 2017 · 100 commits to master since this release

Assets 2
  • Dynamically insert handlers 💪 Fixes #376.
  • Add context to WebSocket. This allows one to use HTTP::Server::Context in ws 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 supporting CORS 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