Documentation ¶
Index ¶
- Constants
- func Close(ctx context.Context, closer io.Closer)
- func Respond(w http.ResponseWriter, status int)
- func RespondWithBody(ctx context.Context, w http.ResponseWriter, status int, data interface{})
- func RespondWithError(ctx context.Context, w http.ResponseWriter, status int, err error)
- type Error
- type ErrorResponse
Constants ¶
View Source
const ( // ContentTypeApplicationJSON missing godoc ContentTypeApplicationJSON = "application/json" // HeaderContentTypeKey missing godoc HeaderContentTypeKey = "Content-Type" )
Variables ¶
This section is empty.
Functions ¶
func Respond ¶
func Respond(w http.ResponseWriter, status int)
Respond writes a http response only with status, without body
func RespondWithBody ¶
func RespondWithBody(ctx context.Context, w http.ResponseWriter, status int, data interface{})
RespondWithBody writes a http response using with the JSON encoded data as payload
func RespondWithError ¶
RespondWithError writes a http response using with the JSON encoded error wrapped in an Error struct
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
ErrorResponse missing godoc
Click to show internal directories.
Click to hide internal directories.