Documentation
¶
Index ¶
- type Response
- func (r *Response) BadRequest(err string)
- func (r *Response) Created(data []byte)
- func (r *Response) ServerError(err string)
- func (r *Response) WriteError(status int, err string)
- func (r *Response) WriteHeader(headerKey string, value string)
- func (r *Response) WriteJSON(data []byte)
- func (r *Response) WriteJSONWithStatusCode(data []byte, status int)
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 is used to facilitate writing http responses
func CreateResponse ¶
func CreateResponse(writer http.ResponseWriter, logger debug.Logger) *Response
CreateResponse returns a new response object
func (*Response) BadRequest ¶
BadRequest Writes a status badrequest and a err message
func (*Response) Created ¶
Created returns http created status code and write the newly created object
func (*Response) ServerError ¶
ServerError returns internalServerError status code and log the error
func (*Response) WriteError ¶
WriteError writes a generic error to the reponse
func (*Response) WriteHeader ¶
WriteHeader write a header to a response(prefer not using this directly)- call this before WriteJSON
func (*Response) WriteJSON ¶
WriteJSON write json to the response and set header type to json- status code is 200ok
func (*Response) WriteJSONWithStatusCode ¶
WriteJSONWithStatusCode write a json and a status code to the response
Click to show internal directories.
Click to hide internal directories.