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

x/ayonli_jsext/http/util.ts>parseContentType

A JavaScript extension package for building strong and modern applications.
Latest
function parseContentType
import { parseContentType } from "https://deno.land/x/ayonli_jsext@v0.9.72/http/util.ts";

Parses the Content-Type header.

Examples

Example 1

import { parseContentType } from "@ayonli/jsext/http";

const type = parseContentType("text/html; charset=utf-8");
console.log(type);
// { type: "text/html", charset: "utf-8" }

const type2 = parseContentType("multipart/form-data; boundary=----WebKitFormBoundaryzjK4sVZ2QeZvz5zB");
console.log(type2);
// { type: "multipart/form-data", boundary: "----WebKitFormBoundaryzjK4sVZ2QeZvz5zB" }

Parameters

str: string