Skip to main content
Module

x/type_is/mod.ts>normalize

Infer the content-type of a HTTP Header for Deno
Latest
variable normalize
import { normalize } from "https://deno.land/x/type_is@1.0.3/mod.ts";

Normalize a mime type. If it's a shorthand, expand it to a valid mime type.

In general, you probably want:

const type = is(req, ['urlencoded', 'json', 'multipart']);

Then use the appropriate body parsers. These three are the most common request body types and are thus ensured to work.

type

(type: string) => string | undefined