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>;
}
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
ReadonlybaseURL
baseURL: string
Readonlyclient Ip
clientIp: string
Readonlyclient Web Server
clientWebServer: number
Readonlyheaders
headers: Headers
Readonlylocal Path
localPath: string
Readonlymethod
Returns request's HTTP method, which is "GET" by default.
Readonlyurl
url: string
Returns the URL of request as a string.
Methods
encode For Transfer
Returns { transferList: TransferListItem[]; value: WebRequestTransferData }
get All Cookies
This returns all the cookies originally sent by the client. They are not decrypted.
Returns Record<string, string>
- The cookies
get Cookie
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
- name: string
get Debug Settings
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 }
get OriginURL
Parameters
- pathname: string
Returns null | string
json
Returns Promise<unknown>
text
Returns Promise<string>
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