add adds a marshaler for a case-sensitive MIME type string ("*" to match any MIME type).
(mime string, marshaler Marshaler)
| 73 | // add adds a marshaler for a case-sensitive MIME type string ("*" to match any |
| 74 | // MIME type). |
| 75 | func (m marshalerRegistry) add(mime string, marshaler Marshaler) error { |
| 76 | if len(mime) == 0 { |
| 77 | return errors.New("empty MIME type") |
| 78 | } |
| 79 | |
| 80 | m.mimeMap[mime] = marshaler |
| 81 | |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | // makeMarshalerMIMERegistry returns a new registry of marshalers. |
| 86 | // It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. |
no outgoing calls
no test coverage detected