WebRequest | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Interface WebRequest

    interface WebRequest {
        baseURL: string;
        clientIp: string;
        clientWebServer: number;
        headers: Headers;
        localPath: string;
        method: HTTPMethod;
        url: string;
        encodeForTransfer(): {
            transferList: TransferListItem[];
            value: WebRequestTransferData;
        };
        getAllCookies(): Record<string, string>;
        getCookie(name: string): null | string;
        getDebugSettings(): { flags: DebugFlags };
        getOriginURL(pathname: string): null | string;
        json(): Promise<unknown>;
        text(): Promise<string>;
    }

    Hierarchy

    • SupportedRequestSubset
      • WebRequest
    Index

    Properties

    baseURL: string
    clientIp: string
    clientWebServer: number
    headers: Headers

    Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

    MDN Reference

    localPath: string
    method: HTTPMethod

    Returns request's HTTP method, which is "GET" by default.

    MDN Reference

    url: string

    Returns the URL of request as a string.

    MDN Reference

    Methods

    • Returns { transferList: TransferListItem[]; value: WebRequestTransferData }

    • This returns all the cookies originally sent by the client. They are not decrypted.

      Returns Record<string, string>

      • The cookies
    • This returns a single cookie originally sent by the client. It is not decrypted.

      Parameters

      • name: string

        The name of the cookie

      Returns null | string

      • The cookie value or null if not found
    • The return value only contains the trusted flags set in this request (from both cookies and URL - either signed or part of the subset of flags that do not need a signature) You should normally use debugFlags from @webhare/env - request specific flags will be merged into this set for the current code context.

      Returns { flags: DebugFlags }

    • Parameters

      • pathname: string

      Returns null | string

    • Returns Promise<unknown>

    • Returns Promise<string>