httputil

package
v0.0.0-...-9835270 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2021 License: AGPL-3.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogThenError

func LogThenError(req *http.Request, err error) util.JSONResponse

LogThenError logs the given error then returns a matrix-compliant 500 internal server error response. This should be used to log fatal errors which require investigation. It should not be used to log client validation errors, etc.

func LogThenErrorCtx

func LogThenErrorCtx(ctx context.Context, err error) (int, *jsonerror.MatrixError)

LogThenErrorCtx logs the given error then returns a matrix-compliant 500 internal server error response. This should be used to log fatal errors which require investigation. It should not be used to log client validation errors, etc.

func UnmarshalJSONRequest

func UnmarshalJSONRequest(req *http.Request, iface interface{}) *util.JSONResponse

UnmarshalJSONRequest into the given interface pointer. Returns an error JSON response if there was a problem unmarshalling. Calling this function consumes the request body.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL