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

x/oak_http_proxy/test/deps.ts>Oak.etag.calculate

Proxy middleware for Deno Oak HTTP servers. 🐿 🦕
Latest
function Oak.etag.calculate
Re-export
import { Oak } from "https://deno.land/x/oak_http_proxy@2.3.0/test/deps.ts";
const { calculate } = Oak.etag;

Calculate an ETag for an entity. When the entity is a specific set of data it will be fingerprinted as a "strong" tag, otherwise if it is just file information, it will be calculated as a weak tag.

import { calculate } from "https://deno.land/std@0.224.0/http/etag.ts";
import { assert } from "https://deno.land/std@0.224.0/assert/assert.ts"

const body = "hello deno!";

const etag = await calculate(body);
assert(etag);

const res = new Response(body, { headers: { etag } });

Parameters

entity: Entity
optional
options: ETagOptions = [UNSUPPORTED]

Returns

Promise<string | undefined>