Documentation ¶
Index ¶
Constants ¶
View Source
const ShutdownTimeout = time.Minute
ShutdownTimeout is the timeout for waiting all requests to complete.
Variables ¶
This section is empty.
Functions ¶
func ResponseJSON ¶
func ResponseJSON(w http.ResponseWriter, status int, data interface{}) error
ResponseJSON writes a JSON response to w by using status as http status and data as payload.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse holds the error message.
type ErrorResponseBody ¶
type ErrorResponseBody struct {
Error ErrorResponse `json:"error"`
}
ErrorResponseBody is the skeleton for error messages that should be sent to client.
func NewErrorResponse ¶
func NewErrorResponse(err error) ErrorResponseBody
NewErrorResponse creates a new http error response from err.
Click to show internal directories.
Click to hide internal directories.