Documentation ¶
Index ¶
- func EncodeJSONResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
- func ErrorEncodeJSONResponse(f func(errorVal errors.Error) (code int)) func(_ context.Context, err error, w http.ResponseWriter)
- func HTTPStatusFromCode(code codes.Code) int
- func JSONErrorDecoder(r *http.Response) error
- type BinaryResponser
- type DataRes
- type ErrorRes
- type ErrorResItem
- type ErrorWrapper
- type Paging
- type Responser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeJSONResponse ¶
func EncodeJSONResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
func ErrorEncodeJSONResponse ¶
func HTTPStatusFromCode ¶
HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
func JSONErrorDecoder ¶
Types ¶
type BinaryResponser ¶
type BinaryResponser interface {
GetBinary() (res []byte)
}
type DataRes ¶
type DataRes struct { APIVersion string `json:"apiVersion"` Data interface{} `json:"data"` }
type ErrorRes ¶
type ErrorRes struct {
Error ErrorResItem `json:"error"`
}
type ErrorResItem ¶
type ErrorWrapper ¶
type ErrorWrapper struct {
Error string `json:"error"`
}
Click to show internal directories.
Click to hide internal directories.