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

x/ayonli_jsext/http.ts

A JavaScript extension package for building strong and modern applications.
Latest
import * as ayonliJsext from "https://deno.land/x/ayonli_jsext@v0.9.72/http.ts";

Utility functions for handling HTTP related tasks, such as parsing headers.

Classes

A unified HTTP server interface.

Functions

Calculates the ETag for a given entity.

Gets the cookie by the given name from the Cookie header of the request or the Set-Cookie header of the response.

Gets the cookies from the Cookie header of the request or the Set-Cookie header of the response.

Checks if the value from the If-Match header matches the given ETag.

Checks if the value from the If-None-Match header matches the given ETag.

Parses the Accept, Accept-Encoding and Accept-Language headers.

Parses the Authorization header with the Basic scheme.

Parses the Content-Type header.

Parses the Set-Cookie header.

Parses the Cookie header or the document.cookie property.

Parses the Range header.

Parses the text message as an HTTP request.

Parses the text message as an HTTP response.

Parses the User-Agent header or the navigator.userAgent property.

Returns a random port number that is available for listening.

Serves HTTP requests with the given options.

Serves static files from a file system directory or KV namespace (in Cloudflare Workers).

Sets a cookie in the Set-Cookie header of the response.

Sets the Content-Disposition header with the given filename when the response is intended to be downloaded.

Converts a Cookie object to a string.

Converts a list of cookies to a string that can be used in the Cookie header.

Converts the request object to text format.

Converts the response object to text format.

Gets the suggested response type for the request.

Performs basic authentication verification for the request. When passed, this function returns nothing (undefined), otherwise it returns a Response with status 401 Unauthorized, which should be responded to the client.

Interfaces

Represents the HTTP request Accept, Accept-Encoding and Accept-Language headers.

Represents the HTTP request Authorization header with the Basic scheme.

Represents the HTTP request or response Content-Type header.

Represents an HTTP Cookie.

Represents the network address of a connection peer.

Represents the HTTP request Range header.

Represents the context of an HTTP request. It provides additional information about the request and allows for upgrading the connection to a WebSocket.

Options for serving HTTP requests, used by serve.

Options for serving static files, used by serveStatic.

Represents the user agent information.

Type Aliases

The handler for processing errors happened during processing HTTP requests.

The handler for processing HTTP requests.