DCS World Typescript
    Preparing search index...

    Type Alias HttpRequest<PARAMS>

    Represents an HTTP request received by the server.

    This type is used to define the structure of an HTTP request. It encapsulates various components of a typical HTTP request, such as headers, method, URL, and body.

    const httpRequest: HttpRequest = {
    headers: {'Content-Type': 'application/json'},
    method: 'POST',
    originalUrl: 'http://example.com/api/data?user=123',
    protocol: 'HTTP/1.1',
    path: '/api/data',
    parameters: { user: '123' },
    body: '{"name": "John Doe"}'
    };
    type HttpRequest<PARAMS = Record<string, string>> = {
        body?: string;
        headers: Record<string, string>;
        method: string;
        originalUrl: string;
        parameters: PARAMS;
        path: string;
        protocol: string;
    }

    Type Parameters

    • PARAMS = Record<string, string>
    Index

    Properties

    body?: string

    Optional body of the request.

    headers: Record<string, string>

    The HTTP headers as a record of key-value pairs.

    method: string

    The HTTP method used for the request, e.g., 'GET', 'POST'.

    originalUrl: string

    The full URL as received in the HTTP request line.

    parameters: PARAMS

    Query parameters parsed from the URL as a record of key-value pairs.

    path: string

    The path part of the URL, excluding the query string.

    protocol: string

    The protocol used in the request, typically 'HTTP/1.1' or 'HTTP/2.0'.