import http from "node:http"; import net from "node:net"; import accepts from "accepts"; import { Fritter } from "./Fritter.js"; import { FritterContext } from "./FritterContext.js"; import { FritterHttpMethod } from "../types/FritterHttpMethod.js"; /** An object containing information about the request. */ export declare class FritterRequest { #private; /** The Fritter instance that created this request. */ fritter: Fritter; /** The Fritter context. */ fritterContext: FritterContext; /** The raw Node.js HTTP request. */ nodeRequest: http.IncomingMessage; /** The raw Node.js HTTP response. */ nodeResponse: http.ServerResponse; /** * Constructs a new Fritter request using the given Node.js HTTP request. * * @param fritter The Fritter instance that created this request. * @param fritterContext The Fritter context. * @param nodeRequest A Node.js HTTP request. * @param nodeResponse A Node.js HTTP response. */ constructor(fritter: Fritter, fritterContext: FritterContext, nodeRequest: http.IncomingMessage, nodeResponse: http.ServerResponse); /** Gets the Accepts object for this request. */ getAccepts(): accepts.Accepts; /** Gets the charset of the request's content type. */ getCharset(): string | null; /** Gets the content length of the request. */ getContentLength(): number; /** Gets the content type of the request. */ getContentType(): string | null; /** * If the request has no body, returns null. * * If the request has a body but is none of the types specified, returns false. * * Otherwise, returns the type of the request body. */ getFirstMatchingType(types: string[]): string | false; /** * Gets the first value of the given header. * * @param headerName The name of the header to get the value of. This is case-insensitive. * @returns The first value of the given header, or null if the header does not exist. */ getHeaderValue(headerName: string): string | null; /** * Gets all values of the given header. * * @param headerName The name of the header to get the values of. This is case-insensitive. * @returns An array of all values of the given header, or an empty array if the header does not exist. */ getHeaderValueArray(headerName: string): string[]; /** Gets the HTTP method of the request. */ getHttpMethod(): FritterHttpMethod; /** Gets the host of the request. */ getHost(): string | null; /** Gets the hostname (host without port) of the request. */ getHostName(): string | null; /** Gets the full href of the request. */ getHref(): string; /** Gets the IP address of the request. */ getIp(): string; /** Gets the IP address chain of the request, starting with the client IP. */ getIpChain(): string[]; /** Gets the origin of the request. */ getOrigin(): string; /** Gets the path of the request, without the query string. */ getPath(): string; /** The protocol of the request. */ getProtocol(): "http" | "https"; /** Gets the query parameters of the request. */ getSearchParams(): import("url").URLSearchParams; /** Gets the socket of the request. */ getSocket(): net.Socket; /** Gets the subdomains of the request. */ getSubdomains(): string[]; /** A URL object representing the URL of the request. */ getUrl(): URL; /** Returns true if the request has a body. */ hasBody(): boolean; /** Returns true if the client has an up-to-date copy of the resource. */ isFresh(): boolean; /** Returns true if the request is idempotent. */ isIdempotent(): boolean; /** Returns true if the request is secure. */ isSecure(): boolean; /** Returns true if the client has an out-of-date copy of the resource. */ isStale(): boolean; /** Sets the content length of the request. */ setContentLength(value: number): void; /** Sets the HTTP method of the request. */ setHttpMethod(method: FritterHttpMethod): void; /** Sets the host of the request. */ setHost(value: string | null): void; /** Sets the IP address of the request. */ setIp(value: string): void; /** Sets the protocol of the request. */ setProtocol(protocol: "http" | "https"): void; /** Sets the URL of the request. */ setUrl(url: URL): void; } //# sourceMappingURL=FritterRequest.d.ts.map