Documentation ¶
Index ¶
- type NormalResponse
- func CreateNormalResponse(header http.Header, body []byte, status int) *NormalResponse
- func Empty(status int) *NormalResponse
- func Error(status int, message string, err error) *NormalResponse
- func JSON(status int, body interface{}) *NormalResponse
- func Respond(status int, body interface{}) *NormalResponse
- func Success(message string) *NormalResponse
- type RedirectResponse
- type Response
- type StreamingResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NormalResponse ¶
type NormalResponse struct {
// contains filtered or unexported fields
}
func CreateNormalResponse ¶
func CreateNormalResponse(header http.Header, body []byte, status int) *NormalResponse
func Error ¶
func Error(status int, message string, err error) *NormalResponse
Error creates an error response.
func Respond ¶
func Respond(status int, body interface{}) *NormalResponse
Respond creates a response.
func (*NormalResponse) ErrMessage ¶
func (r *NormalResponse) ErrMessage() string
ErrMessage gets the response's errMessage.
func (*NormalResponse) Header ¶
func (r *NormalResponse) Header(key, value string) *NormalResponse
func (*NormalResponse) Status ¶
func (r *NormalResponse) Status() int
Status gets the response's status.
func (*NormalResponse) WriteTo ¶
func (r *NormalResponse) WriteTo(ctx *models.ReqContext)
type RedirectResponse ¶
type RedirectResponse struct {
// contains filtered or unexported fields
}
RedirectResponse represents a redirect response.
func Redirect ¶
func Redirect(location string) *RedirectResponse
func (*RedirectResponse) Body ¶
func (r *RedirectResponse) Body() []byte
Body gets the response's body. Required to implement api.Response.
func (*RedirectResponse) Status ¶
func (*RedirectResponse) Status() int
Status gets the response's status. Required to implement api.Response.
func (*RedirectResponse) WriteTo ¶
func (r *RedirectResponse) WriteTo(ctx *models.ReqContext)
WriteTo writes to a response.
type Response ¶
type Response interface { // WriteTo writes to a context. WriteTo(ctx *models.ReqContext) // Body gets the response's body. Body() []byte // Status gets the response's status. Status() int }
Response is an HTTP response interface.
type StreamingResponse ¶
type StreamingResponse struct {
// contains filtered or unexported fields
}
StreamingResponse is a response that streams itself back to the client.
func JSONStreaming ¶
func JSONStreaming(status int, body interface{}) StreamingResponse
JSONStreaming creates a streaming JSON response.
func (StreamingResponse) Body ¶
func (r StreamingResponse) Body() []byte
Body gets the response's body. Required to implement api.Response.
func (StreamingResponse) Status ¶
func (r StreamingResponse) Status() int
Status gets the response's status. Required to implement api.Response.
func (StreamingResponse) WriteTo ¶
func (r StreamingResponse) WriteTo(ctx *models.ReqContext)
WriteTo writes the response to the provided context. Required to implement api.Response.