makeMarshalerMIMERegistry returns a new registry of marshalers. It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. For example, you could allow the client to specify the use of the runtime.JSONPb marshaler with an "application/jsonpb" Content-Ty
()
| 91 | // "*" can be used to match any Content-Type. |
| 92 | // This can be attached to a ServerMux with the marshaler option. |
| 93 | func makeMarshalerMIMERegistry() marshalerRegistry { |
| 94 | return marshalerRegistry{ |
| 95 | mimeMap: map[string]Marshaler{ |
| 96 | MIMEWildcard: defaultMarshaler, |
| 97 | }, |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | // WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound |
| 102 | // Marshalers to a MIME type in mux. |