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

Method ContentType

error.go:127–135  ·  view source on GitHub ↗

ContentType provides a filter to adjust response content types. This is used to ensure e.g. `application/problem+json` content types defined in RFC 9457 Problem Details for HTTP APIs are used in responses to clients.

(ct string)

Source from the content-addressed store, hash-verified

125// used to ensure e.g. `application/problem+json` content types defined in
126// RFC 9457 Problem Details for HTTP APIs are used in responses to clients.
127func (e *ErrorModel) ContentType(ct string) string {
128 if ct == "application/json" {
129 return "application/problem+json"
130 }
131 if ct == "application/cbor" {
132 return "application/problem+cbor"
133 }
134 return ct
135}
136
137// ContentTypeFilter allows you to override the content type for responses,
138// allowing you to return a different content type like

Callers 1

TestErrorFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestErrorFunction · 0.76