Documentation ¶
Index ¶
- type Response
- func (resp *Response) BadRequest(format string, args ...interface{}) error
- func (resp *Response) Created() error
- func (resp *Response) Error(code int, format string, args ...interface{}) error
- func (resp *Response) Forbidden(format string, args ...interface{}) error
- func (resp *Response) InternalServerError(format string, args ...interface{}) error
- func (resp *Response) MethodNotAllowed(format string, args ...interface{}) error
- func (resp *Response) NoContent() error
- func (resp *Response) NotFound(format string, args ...interface{}) error
- func (resp *Response) OK(payload interface{}) error
- func (resp *Response) Object(code int, payload interface{}) error
- func (resp *Response) ResponseWriter() http.ResponseWriter
- func (resp *Response) WithoutContent(code int) error
- type Responser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response - provide methods for creating responses.
func (*Response) BadRequest ¶
func (*Response) InternalServerError ¶
func (*Response) MethodNotAllowed ¶
func (*Response) ResponseWriter ¶
func (resp *Response) ResponseWriter() http.ResponseWriter
func (*Response) WithoutContent ¶
type Responser ¶
type Responser interface { // ResponseWriter - returns http.ResponseWriter associated with request. ResponseWriter() http.ResponseWriter // Object - responses with provided custom code and body. // Body will be marshaled using service-defined object and marshaler. Object(code int, payload interface{}) error // WithourContent - responses with provided custom code and no body. WithoutContent(code int) error // Error - responses custom error with provided code and formatted string message. Error(code int, format string, args ...interface{}) error // OK - writes payload into json's 'result' field with 200 http code. OK(payload interface{}) error // Created - responses with 201 http code and no content. Created() error // NoContent - responses with 204 http code and no content. NoContent() error // BadRequest - responses with 400 code and provided formatted string message. BadRequest(format string, args ...interface{}) error // Forbidden - responses with 403 error code and provided formatted string message. Forbidden(format string, args ...interface{}) error // NotFound - responses with 404 error code and provided formatted string message. NotFound(format string, args ...interface{}) error // MethodNotAllowed - responses with 405 error code and provided formatted string message. MethodNotAllowed(format string, args ...interface{}) error // InternalServerError - responses with 500 error code and provided formatted string message. InternalServerError(format string, args ...interface{}) error }
Click to show internal directories.
Click to hide internal directories.