serverMux

package
v2.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error)

ErrorHandler is a convenient HTTP error handler for grpc.

func New

func New(opts ...runtime.ServeMuxOption) *runtime.ServeMux

New creates default server mux

func NewRouter

func NewRouter(queryCaseInsensitive map[string]string, authInterceptor kitHttp.Interceptor, opts ...kitHttp.LogOpt) *router.Router

NewRouter creates router with default middlewares

func WriteError

func WriteError(w netHttp.ResponseWriter, err error)

WriteError encodes error as google.golang.org/genproto/googleapis/rpc/status

Types

type ErrorResponseWrapperWriter

type ErrorResponseWrapperWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewErrorResponseWrapperWriter

func NewErrorResponseWrapperWriter(w http.ResponseWriter, code int) *ErrorResponseWrapperWriter

func (*ErrorResponseWrapperWriter) Flush

func (w *ErrorResponseWrapperWriter) Flush()

func (*ErrorResponseWrapperWriter) WriteHeader

func (w *ErrorResponseWrapperWriter) WriteHeader(_ int)

type JsonMarshaler

type JsonMarshaler struct {
	*runtime.JSONPb
}

func NewJsonMarshaler

func NewJsonMarshaler() *JsonMarshaler

NewJsonMarshaler is a marshaler tries to encode internal data to jsons and cbors string as json object

func (*JsonMarshaler) ContentType

func (*JsonMarshaler) ContentType(_ interface{}) string

ContentType always returns "application/json".

func (*JsonMarshaler) Marshal

func (j *JsonMarshaler) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into JSON.

type JsonpbMarshaler

type JsonpbMarshaler struct {
	*runtime.JSONPb
}

func NewJsonpbMarshaler

func NewJsonpbMarshaler() *JsonpbMarshaler

NewJsonpbMarshaler is a proto marshaler that uses jsonpb. proto <=> jsonpb

func (*JsonpbMarshaler) ContentType

func (*JsonpbMarshaler) ContentType(_ interface{}) string

ContentType always returns "application/json".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL