Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeToError ¶ added in v1.2.0
CodeToError translate grpc codes to error
func DefaultHTTPError ¶ added in v1.2.3
func DefaultHTTPError(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, _ *http.Request, err error)
DefaultHTTPError is the default implementation of HTTPError. If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. If otherwise, it replies with http.StatusInternalServerError.
The response body returned by this function is a JSON object, which contains a member whose key is "error" and whose value is err.Error().
func DefaultHTTPErrorCustomCodes ¶ added in v1.2.3
DefaultHTTPErrorCustomCodes set custom error codes for DefaultHTTPError
Types ¶
type MuxedGrpc ¶ added in v1.2.1
type MuxedGrpc struct { }
MuxedGrpc check the context is by mux grpc
type ServeMux ¶
ServeMux the custom serve mux that implement grpc ServeMux to simplify the http restful
func NewServeMux ¶
func NewServeMux(opts ...runtime.ServeMuxOption) *ServeMux
NewServeMux allocates and returns a new ServeMux.