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@v11.0.0/etag.ts";

A collection of APIs for dealing with ETags in requests and responses.

Functions

Calculate an ETag value for an entity. If the entity is FileInfo, then the tag will default to a weak ETag. options.weak overrides any default behavior in generating the 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 an entity and returns true if the ETag for the entity matches the supplied value, otherwise false.

A helper function that takes the value from the If-No-Match header and an entity and returns false if the ETag for the entity matches the supplied value, otherwise false.

Interfaces

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