import { matches } from "https://deno.land/x/oak_commons@0.6.0/media_types.ts";
Determines if the provided media type matches one of the supplied media
types. If there is a match, the matched media type is returned, otherwise
undefined
is returned.
Each type in the media types array can be one of the following:
- A file extension name such as
json
. This name will be returned if matched. - A media type such as
application/json
. - A media type with a wildcard such as
*/*
or*/json
orapplication/*
. The full media type will be returned if matched. - A suffix such as
+json
. This can be combined with a wildcard such as*/vnd+json
orapplication/*+json
. The full mime type will be returned if matched. - Special cases of
urlencoded
andmultipart
which get normalized toapplication/x-www-form-urlencoded
andmultipart/*
respectively.