decode use the content type to decode the data from r into t.
(r io.Reader, contentType string, options *RouteOptions)
| 123 | |
| 124 | // decode use the content type to decode the data from r into t. |
| 125 | func decode[T any](r io.Reader, contentType string, options *RouteOptions) (T, error) { |
| 126 | var t T |
| 127 | decoder, err := encoding.ContentTypeDecoder(r, contentType, options.codecs) |
| 128 | if err != nil { |
| 129 | return t, err |
| 130 | } |
| 131 | |
| 132 | err = decoder.Decode(&t) |
| 133 | return t, err |
| 134 | } |
| 135 | |
| 136 | // decodeIn use the content type to decode the data from r into t (which should be a pointer). |
| 137 | func decodeIn(t any, r io.Reader, contentType string, options *RouteOptions) (any, error) { |
nothing calls this directly
no test coverage detected