Skip to main content
Module

x/shed/middleware.ts

All Worker Tools under a single roof
Latest
import * as shed from "https://deno.land/x/shed@v0.1.0-pre.10/middleware.ts";

Variables

A CORS middleware that gives clients exactly the permissions they ask for, unless constrained by the definitions in options.

Standard MIME type for binary data

A CORS middleware that gives clients exactly the permissions they ask for, unless constrained by the definitions in options.

A CORS middleware that only grants the permissions defined via options.

Non-standard MIME type for binary data. Sometimes used, so included anyway.

Functions

Determines if a request body content type is acceptable to this endpoint.

Determines if a request body content encoding is acceptable to this endpoint.

Determines if a request body content language is acceptable to this endpoint.

Type-enforcing left-to-right function composition function. The first parameter can be a function of any arity, but the remaining parameters must be unary functions. The return type of one function must be compatible with the argument of next function in the argument list (i.e. types flow from left-to-right)

Performs content negotiation over the content encoding of the response.

Performs content negotiation over the content language of the response.

Performs content negotiation over the content type of the response.

Cookie session middleware for worker runtimes.

A helper function to create user-defined middleware.

f
executeEffects
deprecated

Performs content negotiation over the content type of the response.

Performs content negotiation over the content encoding of the response.

Performs content negotiation over the content language of the response.

Session middleware for worker runtimes.

f
withMiddleware
deprecated

Takes a handler function of the form (x: Request, ctx: Context) => Awaitable<Response> and applies middleware to it.

Interfaces

Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.

This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch.

Type Aliases

The Cache-Control HTTP header field holds directives (instructions) — in both requests and responses — that control caching in browsers and shared caches (e.g. Proxies, CDNs).

Helper type to get the context type of a given middleware function.

An object of the cookies sent with this request. It is for reading convenience only. To make changes, use the associated cookie store instead (provided by the middleware along with this object)

T
ErrorContext
deprecated
T
ErrorHandler
deprecated
T
Handler
deprecated
T
Middleware
deprecated

Any record of unknown values