Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/oak_commons/media_types.ts

A set of APIs for handling HTTP and HTTPS requests with Deno 🐿️ 🦕
Go to Latest
import * as oakCommons from "https://deno.land/x/oak_commons@0.6.0/media_types.ts";

Several APIs designed for processing of media types in request bodies.

MediaType, parse() and format() are inspired media-typer at https://github.com/jshttp/media-typer/ which is licensed as follows:

Copyright(c) 2014-2017 Douglas Christopher Wilson

MIT License

matches() is inspired by type-is at https://github.com/jshttp/type-is/ which is licensed as follows:

Copyright(c) 2014 Jonathan Ong Copyright(c) 2014-2015 Douglas Christopher Wilson

MIT License

Classes

A class which encapsulates the information in a media type, allowing inspecting of modifying individual parts of the media type.

Functions

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.

Parses a media type into a MediaType object which provides parts of the media type as individual properties.