Releases: gebes/there
Header
Module name
Sanitized module name
Apply default content type
When no content type is specified, handlers like Json, Xml or String will automatically apply a content type
Default handler and middleware fix
Full Changelog: v2.2.2...v2.2.3
Mux rework
Full Changelog: v2.2.0...v2.2.1
Mux rework
Moved headers and statuses to the status and header package
Speed improvement with the built in go mux
What's Changed
- Added File Serving and Requiring Middlewares by @tobyguelly in #6
- Solving Issues of #8 and #10 by @wellisrite in #14
- Fix panics on response.go file method by @wellisrite in #15
- Inline Responses by @ninjarogue in #19
- Inline Html, Message, and String by @ninjarogue in #21
- Improved Error and XML Responses by @ninjarogue in #22
- Fixed return statement by @ninjarogue in #23
- Improvement of Error Responses by @ninjarogue in #24
- Revert "Improvement of Error Responses" by @gebes in #26
- Revert "Fixed return statement" by @gebes in #27
- Revert "Improved Error and XML Responses" by @gebes in #28
- Resolved conflicts #31 by @gebes in #32
- Revert "Resolved conflicts #31" by @gebes in #33
- v2.2 by @ninjarogue in #31
New Contributors
- @tobyguelly made their first contribution in #6
- @wellisrite made their first contribution in #14
Full Changelog: v2.1.3...v2.2.0
Quality of life improvements
Changes to the router configuration
Route not found handler
Override the RouteNotFoundHandler
to change default behavior.
//RouterConfiguration is a straightforward place to override default behavior of the router
type RouterConfiguration struct {
//RouteNotFoundHandler gets invoked, when the specified URL and method have no handlers
RouteNotFoundHandler Endpoint
}
http.Server
On the router you now got direct access to the http.Server
err := router.Server.Shutdown(context.Background())
Redirect status code
Minor change to the Redirect response
There now provides the option to set the status code for a Redirect
response.
func Redirect(code int, url string) HttpResponse {
router.Get("/redirect", func(request HttpRequest) HttpResponse {
return Redirect(StatusMovedPermanently, "https://google.com")
})
WithHeader bug fix
Changes
- The WithHeader wrapper now only sets header if they haven't been set before.
- This gives the option to override headers from other responses.
Example
We override the Json response Content-Type header from application/json
to application/json; charset=utf-8
. Because we set the header to application/json; charset=utf-8
the Header from the Json Response won't be set.
return WithHeaders(MapString{
"Content-Type": "application/json; charset=utf-8",
}, Json(StatusOK, data))
🥳 Middlewares & Responses Rework and new docs
This release adds many (breaking) changes.
Documentation
To get a clear overview, visit the all-new docs.
Middlewares
Middlewares have been reworked from the ground up to provide the full functionality you would expect from a router. Now you can use all the Middlewares you have ever created in your life, with little to no changes in There!
Previous middlewares still work as they were intended. Only several small things need to be changed
- Context is now parsed with the
request.WithContext(ctx)
method - Instead of
Next()
you now return the parsednext
parameter
Find more info about the changes in the docs.
HttpResponse
The interface has been reworked, and it is now way easier to implement your own HttpResponses. Also, Msgpack and Yaml have been removed to eliminate all third-party dependencies to make There even more lightweight.
You can find a list of all reworked HttpResponses in the docs.
Most important change
There now has a great new mascot! How do you like it?
Help
If you need help, join our discord or create an issue.