net/http
middleware v1.1.0: Better error handling, allow not validating Servers
(by configuration) and return an HTTP 405 Method Not Allowed where appropriate
#1959
jamietanna
announced in
Announcements
Replies: 1 comment
-
Off the back of this, we've got some follow-up pieces:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Direct link to release
🔊 Notable features
Error handling is now significantly better
As part of #35, we have introduced a much more powerful means to handle the errors returned by the OpenAPI Validation middleware.
This has been a long-standing issue, and we appreciate the community's patience as well as different proposals over time.
Previously, when creating an error handler, the method signature was fairly lacking:
This didn't give much information around what had happened - or in which route/endpoint - and not having the raw
error
made observability and additional steps to respond appropriately more difficult.With this release, it's now possible to have the raw
error
, information about the current request + itscontext.Context
, as well as some additional pieces of metadata inside theErrorHandlerWithOpts
:There is a full example of usage in the Go doc for this project.
Note that the old method,
ErrorHandler
has been marked as deprecated - there is no planned removal date, and this is largely as a way to "nudge" folks to using the new, more powerful, method.🚀 New features and improvements
error
to a method parameter, not part ofErrorHandlerOpts
(Issue with RequestBody types in generated code #43) @jamietannaServers
at all (Client implantation example #37) @jamietanna🐛 Bug fixes
📝 Documentation updates
FUNDING.yml
(Embed runtime code into generated boilerplate #20) @jamietanna👻 Maintenance
testutil
(typo #33) @jamietanna📦 Dependency updates
Sponsors
We would like to thank our sponsors for their support during this release.
Beta Was this translation helpful? Give feedback.
All reactions