[]previous and next page

isJsonContentType

True when a Content-Type header names JSON (application/json, application/*+json).

True when a Content-Type header names JSON (application/json, application/*+json).

Import#

ts
import { isJsonContentType } from "@shadow-js/dusk/server";

Signature#

ts
function isJsonContentType(contentType: string | null): boolean

Parameters#

Name Description
contentType The header value, or null.

Returns#

Whether the type is JSON.

Examples#

ts
isJsonContentType("application/vnd.api+json; charset=utf-8"); // true