x/oak/mod.ts

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Very Popular
Go to Latest
namespace etag
import { etag } from "https://dotland-vbqsvsrpfncg.deno-staging.dev/x/oak@v11.1.0/mod.ts?s=etag";

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.