v2.14.0
Overview
Support for netip.Addr
Type
In addition to a net.IP
, request inputs can now use a netip.Addr
type, passing in a value like 127.0.0.1
from the client in e.g. query params and it will parse into the correct type with validation.
Error Wrapping Improvements
Arbitrary headers can now be added if needed by wrapping errors. For example:
return nil, huma.ErrorWithHeaders(
huma.Error404NotFound("thing not found"),
http.Header{
"Cache-Control": {"no-store"},
},
)
This uses Go's built-in error wrapping functionality and works via errors.Is
/errors.As
for any error which satisfies the huma.HeadersError
interface.
What's Changed
- test: more tests for
cookie
by @behnambm in #391 - build(deps): bump golang.org/x/net from 0.21.0 to 0.23.0 by @dependabot in #394
- Support
netip.Addr
as a special type by @wolveix in #396 - feat: wrap errors to set headers by @danielgtaylor in #387
New Contributors
Full Changelog: v2.13.1...v2.14.0