Documentation
¶
Index ¶
- Variables
- func GetLogger(ctx context.Context) logger
- func GetRequest(ctx context.Context) *http.Request
- func Redirect(code int, location string) interface{ ... }
- func SetLogger(ctx context.Context, l logger) context.Context
- func SetRequest(ctx context.Context, req *http.Request) context.Context
- func StatusCodeOf(err error) int
- func StatusCodeOfOrDefault(err error, code int) int
- type APIError
- type Empty
- type ErrorResponse
- type Redirector
- type StatusCoder
Constants ¶
This section is empty.
Variables ¶
View Source
var (
API_ERROR_FORMAT = "api-error: %s"
)
View Source
var (
DEBUG = false
)
Functions ¶
func StatusCodeOf ¶
func StatusCodeOfOrDefault ¶
Types ¶
type APIError ¶
type APIError struct {
// contains filtered or unexported fields
}
func NewAPIError ¶
func (*APIError) StatusCode ¶
type ErrorResponse ¶
type ErrorResponse struct { Code int `json:"code"` Error string `json:"error"` Detail []string `json:"detail,omitempty"` }
ErrorResponse represents a normal error response type
type Redirector ¶
type Redirector interface {
Redirect(http.ResponseWriter, *http.Request)
}
type StatusCoder ¶
type StatusCoder interface {
StatusCode() int
}
func NoContent ¶
func NoContent(code int) StatusCoder
Click to show internal directories.
Click to hide internal directories.