Help us shape the future of Go! Take the 2026 Go Developer Survey

util

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPRequestAccepts

func HTTPRequestAccepts(r *http.Request, mime string) bool

HTTPRequestAccepts returns true if the given request accepts the provided MIME type

func JSONErrResponse

func JSONErrResponse(w http.ResponseWriter, err error, statusCode int)

JSONErrResponse Sends an `error` as a JSON object with a `message` property

func JSONResponse

func JSONResponse(w http.ResponseWriter, v interface{}, statusCode int)

JSONResponse Sends a JSON payload in response to a HTTP request

func ParseJSONBody

func ParseJSONBody(v interface{}, w http.ResponseWriter, r *http.Request) error

ParseJSONBody attempts to parse the request body as JSON

Types

This section is empty.

Jump to

Keyboard shortcuts

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