Skip to main content
Module

std/http/mod.ts

Deno standard library
Go to Latest
import * as mod from "https://deno.land/std@0.209.0/http/mod.ts";

Provides functions for dealing with and matching ETags, including calculate to calculate an etag for a given entity, ifMatch for validating if an ETag matches against a If-Match header and ifNoneMatch for validating an Etag against an If-None-Match header.

See further information on the ETag header on MDN.

Classes

c
Server
deprecated

Transforms server-sent message objects into strings for the client.

Variables

v
CookieMap
deprecated

Provides a way to manage cookies in a request and response on the server as a single iterable collection.

Symbol which is used in mergeHeaders to extract a [string | string][] from an instance to generate the final set of headers.

v
HTTP_METHODS
deprecated
v
isErrorStatus
deprecated
v
isRedirectStatus
deprecated
v
mergeHeaders
deprecated

Allows merging of various sources of headers into a final set of headers which can be used in a Response.

v
SecureCookieMap
deprecated
v
Status
deprecated
v
STATUS_TEXT
deprecated

Functions

Returns an array of media types accepted by the request, in order of preference. If there are no media types supplied in the request, then any media type selector will be returned.

Returns an array of content encodings accepted by the request, in order of preference. If there are no encoding supplied in the request, then ["*"] is returned, implying any encoding is accepted.

Returns an array of languages accepted by the request, in order of preference. If there are no languages supplied in the request, then ["*"] is returned, imply any language is accepted.

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.

Set the cookie header with empty value in the headers to delete it

Parse cookies of a header

Parse set-cookies of a header

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.

f
isHttpMethod
deprecated

Parses a signed cookie to get its value.

f
serve
deprecated
f
serveListener
deprecated
f
serveTls
deprecated

Set the cookie header properly in the headers

Returns a promise with the signed cookie value from the given cryptographic key.

Returns a promise of a boolean indicating whether the signed cookie is valid.

Interfaces

I
ConnInfo
deprecated

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

I
ServeInit
deprecated
I
ServerInit
deprecated
I
ServeTlsInit
deprecated

Type Aliases

T
CookieMapOptions
deprecated
T
Data
deprecated

Types of data that can be signed cryptographically.

T
ErrorStatus
deprecated
T
Handler
deprecated
T
Headered
deprecated
T
HttpMethod
deprecated
T
KeyRing
deprecated

An interface which describes the methods that SecureCookieMap uses to sign and verify cookies.

T
Mergeable
deprecated
T
RedirectStatus
deprecated
T
Status
deprecated
T
SuccessfulStatus
deprecated