///
///
///
///
import { URL, URLSearchParams } from 'url';
/**
* This is passed from the scheduler.
* Be careful with backwards-compatibility when changing this.
*/
export interface RawRequest {
queryParameters: {
[key: string]: string;
};
path: string;
headers: {
[key: string]: string;
};
sourceIp: string;
body: string;
method: string;
traceId: string;
eventSource: string;
url: string;
}
export interface CloudCodeRequestOptions {
method: string;
url: string | URL;
headers: Headers;
body?: string;
buffer?: Buffer;
ip?: string;
}
export declare class CloudCodeRequest {
readonly method: string;
readonly url: URL;
readonly headers: Headers;
readonly ip: string;
private readonly body;
private readonly bufferData;
relativePath: string;
static fromRawRequest(rawRequest: RawRequest): CloudCodeRequest;
constructor(opts: CloudCodeRequestOptions);
get subdomain(): string;
get hostname(): string;
get protocol(): string;
get searchParams(): URLSearchParams;
get path(): string;
buffer(): Buffer;
json(): any;
text(): string;
header(key: string): string;
contentType(): string;
/**
* Returns true if a body is present, and Content-Type is "application/json".
* "application/json; charset=utf-8" is also accepted.
*/
hasJSON(): boolean;
}