MCPcopy
hub / github.com/danielgtaylor/huma / Marshal

Method Marshal

api.go:380–394  ·  view source on GitHub ↗
(w io.Writer, ct string, v any)

Source from the content-addressed store, hash-verified

378}
379
380func (a *api) Marshal(w io.Writer, ct string, v any) error {
381 f, ok := a.formats[ct]
382 if !ok {
383 start, end, err := parseContentType(ct)
384 if err != nil {
385 return err
386 }
387
388 f, ok = a.formats[ct[start:end]]
389 }
390 if !ok {
391 return fmt.Errorf("%w: %s", ErrUnknownContentType, ct)
392 }
393 return f.Marshal(w, v)
394}
395
396func (a *api) UseMiddleware(middlewares ...func(ctx Context, next func(Context))) {
397 a.middlewares = append(a.middlewares, middlewares...)

Callers

nothing calls this directly

Calls 2

parseContentTypeFunction · 0.85
MarshalMethod · 0.65

Tested by

no test coverage detected