Documentation
¶
Index ¶
- func IsCallErrorStatusCode(httpStatusCode int) bool
- func RespondError(w http.ResponseWriter, httpStatusCode int, errorData ErrorResponse)
- func RespondErrorEmpty(w http.ResponseWriter, httpStatusCode int)
- func SetUpCORSFilterByEnv(restContainer *restful.Container, envPrefix string) error
- type CORSFilterConfig
- type ETagResponder
- func (eTagResponder *ETagResponder) RespondGetJSON(req *restful.Request, resp *restful.Response, data interface{}) error
- func (eTagResponder *ETagResponder) RespondGetOctetStream(req *restful.Request, resp *restful.Response, data []byte) error
- func (eTagResponder *ETagResponder) RespondGetProtoMessage(req *restful.Request, resp *restful.Response, protoMsg proto.Message) error
- type EmptyRequest
- type EmptyResponse
- type ErrorResponse
- type ErrorResponseField
- type RequestContext
- type Responder
- type StatsFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCallErrorStatusCode ¶
func RespondError ¶
func RespondError(w http.ResponseWriter, httpStatusCode int, errorData ErrorResponse)
func RespondErrorEmpty ¶
func RespondErrorEmpty(w http.ResponseWriter, httpStatusCode int)
func SetUpCORSFilterByEnv ¶
Types ¶
type CORSFilterConfig ¶
type ETagResponder ¶
type ETagResponder struct {
// contains filtered or unexported fields
}
func NewETagResponder ¶
func NewETagResponder(bufferPoolSize int) *ETagResponder
func (*ETagResponder) RespondGetJSON ¶
func (eTagResponder *ETagResponder) RespondGetJSON( req *restful.Request, resp *restful.Response, data interface{}, ) error
func (*ETagResponder) RespondGetOctetStream ¶
func (eTagResponder *ETagResponder) RespondGetOctetStream( req *restful.Request, resp *restful.Response, data []byte, ) error
func (*ETagResponder) RespondGetProtoMessage ¶
func (eTagResponder *ETagResponder) RespondGetProtoMessage( req *restful.Request, resp *restful.Response, protoMsg proto.Message, ) error
type EmptyRequest ¶
type EmptyRequest struct{}
type EmptyResponse ¶
type EmptyResponse struct{}
type ErrorResponse ¶
type ErrorResponse struct { Code string `json:"code,omitempty"` // We use the term description because it describes the error // to the developer rather than a message for the end user. Description string `json:"description,omitempty"` Fields []ErrorResponseField `json:"fields,omitempty"` DocURL string `json:"doc_url,omitempty"` }
type ErrorResponseField ¶
type RequestContext ¶
type RequestContext interface { api.CallContext HTTPRequest() *http.Request }
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
func RespondTo ¶
func RespondTo(w http.ResponseWriter) Responder
func (Responder) EmptyError ¶
EmptyError responses with empty ErrorResponse with status code set to httpStatusCode.
func (Responder) Error ¶
func (r Responder) Error(errorData ErrorResponse, httpStatusCode int)
Error responses with payload provided as errorResp
func (Responder) SuccessWithHTTPStatusCode ¶
type StatsFilter ¶
type StatsFilter struct {
// contains filtered or unexported fields
}
func NewStatsFilter ¶
func NewStatsFilter() *StatsFilter
func (*StatsFilter) Filter ¶
func (sf *StatsFilter) Filter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain)
func (*StatsFilter) StatsHandler ¶
func (sf *StatsFilter) StatsHandler(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.