MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / WithMarshalerOption

Function WithMarshalerOption

runtime/marshaler_registry.go:103–109  ·  view source on GitHub ↗

WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound Marshalers to a MIME type in mux.

(mime string, marshaler Marshaler)

Source from the content-addressed store, hash-verified

101// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound
102// Marshalers to a MIME type in mux.
103func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption {
104 return func(mux *ServeMux) {
105 if err := mux.marshalers.add(mime, marshaler); err != nil {
106 panic(err)
107 }
108 }
109}

Callers 2

TestMarshalerForRequestFunction · 0.92
TestNonStandardNamesFunction · 0.92

Calls 1

addMethod · 0.80

Tested by 2

TestMarshalerForRequestFunction · 0.74
TestNonStandardNamesFunction · 0.74