Skip to main content
Module

x/http_utils/mod.ts>parseFieldValue

HTTP implementation utility collection
Go to Latest
function parseFieldValue
import { parseFieldValue } from "https://deno.land/x/http_utils@1.0.0-beta.10/mod.ts";

Parse the header field value. Split field values by <quoted-string> or <token>.

import { parseFieldValue } from "https://deno.land/x/http_utils@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std@$VERSION/testing/asserts.ts";

assertEquals(
  parseFieldValue("text/html, image/webp;q=0.8"),
  ["text/html", "image/webp;q=0.8"],
);
assertEquals(parseFieldValue(`"Sat, 04 May 1996", "Wed, 14 Sep 2005"`), [
  `"Sat, 04 May 1996"`,
  `"Wed, 14 Sep 2005"`,
]);

Parameters

fieldValue: string

Returns

string[]