Documentation
¶
Index ¶
- func DrainAndCloseBody(body io.ReadCloser) error
- func DrainAndCloseRequest(r *http.Request) error
- func DrainAndCloseResponse(r *http.Response) error
- func EchoHandler(logger *slog.Logger) func(http.ResponseWriter, *http.Request)
- func NewHTTPClient(globalTimeout time.Duration) *http.Client
- func Recoverer(logger *slog.Logger) func(http.Handler) http.Handler
- func URLSafeBase64() *base64.Encoding
- func UnpackHeaders(h http.Header) map[string]string
- func UnpackRequest(r *http.Request) (map[string]any, error)
- func UnpackRequestBody(h http.Header, body io.ReadCloser) (any, error)
- func UnpackURL(u *url.URL) map[string]any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DrainAndCloseBody ¶ added in v0.0.2
func DrainAndCloseBody(body io.ReadCloser) error
func DrainAndCloseRequest ¶
DrainAndCloseRequest can be used (most probably with defer) from the client side to ensure that the http request body is consumed til the end and closed.
func DrainAndCloseResponse ¶
DrainAndCloseResponse can be used (most probably with defer) from the client side to ensure that the http response body is consumed til the end and closed.
func EchoHandler ¶ added in v0.0.2
func NewHTTPClient ¶
NewHTTPClient returns a new default http client.
func Recoverer ¶
Recoverer returns a recoverer http middleware that logs every panic into the provided slog logger.
func URLSafeBase64 ¶ added in v0.0.2
URLSafeBase64 returns a base64.Encoding based on base64.URLEncoding replacing the default padding character ('=') padding character to a url safe one ('~'). In URL parameters, the following characters are considered safe and do not need encoding [rfc3986](https://www.rfc-editor.org/rfc/rfc3986.html#section-3.1): Alphabetic characters: A-Z, a-z Digits: 0-9 Hyphen: - Underscore: _ Period: . Tilde: ~
func UnpackRequestBody ¶ added in v0.0.2
Types ¶
This section is empty.