darvaza.org/x/web
Helpers for HTTP handlers — content negotiation, middleware, and error management.
Helpers for implementing HTTP handlers. MiddlewareFunc and
MiddlewareErrorFunc compose handler chains, while
HTTPError wraps status
codes as Go errors with handler semantics — factory functions
cover common statuses (301, 302, 400, 404, 500, …).
The qlist sub-package parses
RFC 7231 quality-value lists (Accept, Accept-Encoding) and
selects the best match
via BestQuality()
and BestEncoding().
Header utilities set Cache-Control, Retry-After,
Last-Modified, and evaluate If-Modified-Since for conditional
responses. A path resolver middleware cleans and attaches the
request path to the context.
The resource sub-package
defines a generic Resource[T] interface for RESTful endpoints.
See also§
- Network helpers — darvaza.org/x/net
- TLS certificate management — darvaza.org/x/tls