basalt / http/src / isJsonMediaType
Function: isJsonMediaType()
> isJsonMediaType(header): boolean
Defined in: http/src/media-type.ts:38
True when a Content-Type announces JSON: exactly application/json, or a structured-syntax +json type (application/merge-patch+json, application/vnd.api+json), parameters ignored.
A substring test is NOT enough: text/plain; application/json is a CORS-safelisted type a cross-site form or fetch can send without a preflight, and parsing it as JSON would hand a JSON route a cross-origin request the browser never asked permission for.
Parameters
header
string | readonly string[] | null | undefined
Returns
boolean