WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound Marshalers to a MIME type in mux.
(mime string, marshaler Marshaler)
| 101 | // WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound |
| 102 | // Marshalers to a MIME type in mux. |
| 103 | func 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 | } |