Releases: kemalcr/kemal
Releases · kemalcr/kemal
v1.10.1
v1.10.0
This is the biggest Kemal release ever with new features and a lot of improvements 🎉
- Add modular
Kemal::Routerwith namespaced routing, scoped filters, WebSocket support and flexible mounting while keeping the existing DSL fully compatible #731. Thanks @sdogruyol 🙏
require "kemal"
api = Kemal::Router.new
api.namespace "/users" do
get "/" do |env|
env.json({users: ["alice", "bob"]})
end
get "/:id" do |env|
env.text "user #{env.params.url["id"]}"
end
end
mount "/api/v1", api
Kemal.run- Add
usekeyword for registering global and path-specific middleware, including support for arrays and insertion at a specific position in the handler chain #734. Thanks @sdogruyol 🙏
require "kemal"
# Path-specific middlewares for /api routes
use "/api", [CORSHandler.new, AuthHandler.new]
get "/" do
"Public home"
end
get "/api/users" do |env|
env.json({users: ["alice", "bob"]})
end
Kemal.run- Enhance response helpers to provide chainable JSON/HTML/text/XML helpers,
HTTP::Statussupport and the ability to halt execution from a chained response for concise API error handling #733, #735, #736. Thanks @sdogruyol and @mamantoha 🙏
require "kemal"
get "/users" do |env|
# Default JSON response
env.json({users: ["alice", "bob"]})
end
post "/users" do |env|
# Symbol-based HTTP::Status and chained JSON
env.status(:created).json({id: 1, created: true})
end
get "/admin" do |env|
# Halt immediately with HTML response
halt env.status(403).html("<h1>Forbidden</h1>")
end
get "/api/users" do |env|
# Custom content type (JSON:API)
env.json({data: ["alice", "bob"]}, content_type: "application/vnd.api+json")
end
Kemal.run- Ensure global wildcard filters always execute while keeping namespace filters isolated to their routes #737. Thanks @mamantoha 🙏
- Fix CLI SSL validation and expand CLI option parsing specs #738. Thanks @sdogruyol 🙏
- Make route LRU cache concurrency-safe with Mutex #739. Thanks @sdogruyol 🙏
- Add
raw_bodyto ParamParser for multi-handler body access (e.g. kemal-session) #740. Thanks @sdogruyol 🙏
post "/" do |env|
raw = env.params.raw_body # raw body, multiple handlers can call it
env.params.body["name"] # parsed body
end- Fix OverrideMethodHandler route cache bug when using
_methodoverride #741, #742. Thanks @skojin and @sdogruyol 🙏
v1.9.0
- Crystal 1.19.0 support 🎉
- (SECURITY) Limit maximum request body size to avoid DoS attacks #730. Thanks @sdogruyol 🙏
- Optimize JSON parameter parsing by directly using the request body IO. Thanks @sdogruyol 🙏
v1.8.0
This release brings a lot of performance improvements 🚀
- Enhance HEAD request handling by caching GET route lookups and optimize path construction using string interpolation for improved performance #728. Thanks @sdogruyol 🙏
- Improve error messages #726. Thanks @sdogruyol 🙏
- Optimize route and websocket lookups by caching results to reduce redundant processing in the HTTP server context #725. Thanks @sdogruyol 🙏
- Replace full-flush Route cache with LRU and add a configurable max cache size #724. Thanks @sdogruyol 🙏
v1.7.3
- Refactor #719. Thanks @sdogruyol 🙏
- Improve Kemal test suite. Thanks @sdogruyol 🙏
v1.7.2
v1.7.1
- Improve
StaticFileHandlerto align with latest Crystal implementation #711. Thanks @sdogruyol @straight-shoota 🙏
v1.7.0
All users are strongly advised to update immediately.
- (SECURITY) Fix a Path Traversal Security issue in
StaticFileHandler. See for more details. Huge THANKS to @ahmetumitbayram 🙏 - Crystal 1.16.0 support 🎉
- Add ability to add handlers for raised exceptions #688. Thanks @syeopite 🙏
require "kemal"
class NewException < Exception
end
get "/" do | env |
raise NewException.new()
end
error NewException do | env |
"An error occured!"
end
Kemal.run- Add
all_filesmethod toparamsto support multiple file uploads in names ending with[]#701. Thanks @sdogruyol 🙏
images = env.params.all_files["images[]"]?- Embrace Crystal standard Log for logging #705. Thanks @hugopl 🙏
- Cleanup temporary files for file uploads #707. Thanks @sdogruyol 🙏
- Implement multiple partial ranges #708. Thanks @sdogruyol 🙏
v1.6.0
- Crystal 1.14.0 support 🎉
- Windows support #690. Thanks @sdogruyol 🙏
- Directory Listing: Add UTF-8 Charset to the response Content type #679. Thanks @alexkutsan @Sija 🙏
- Use context instead of response in static_headers helper #681. Thanks @sdogruyol 🙏