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

x/oak/etag.ts

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Very Popular
Go to Latest
import * as oak from "https://deno.land/x/oak@v12.6.0/etag.ts";

A collection of oak specific APIs for management of ETags.

Functions

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.

Create middleware that will attempt to decode the response.body into something that can be used to generate an ETag and add the ETag header to the response.

For a given Context, try to determine the response body entity that an ETag can be calculated from.

A helper function that takes the value from the If-Match header and a calculated etag for the target. By using strong comparison, return true if the values match, otherwise false.

A helper function that takes the value from the If-None-Match header and a calculated etag for the target entity and returns false if the etag for the entity matches the supplied value, otherwise true.

Interfaces

Just the part of Deno.FileInfo that is required to calculate an ETag, so partial or user generated file information can be passed.