responses

package
v0.0.0-...-33a8802 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON writes out a JSON response. The header of the response writer can be initialized before calling this function.

Types

type Context

type Context api.Context

Context is the placeholder for the common API context struct.

func (Context) RespondWithError

func (apiContext Context) RespondWithError(w http.ResponseWriter, r *http.Request, code int, message string, err error)

RespondWithError writes out a JSON error response. The header of the response writer can be initialized before calling this function.

Jump to

Keyboard shortcuts

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