export = HttpClient; /** * Typedef Imports * @typedef {import("../RestNio")} RestNio * @typedef {import("./Client")} Client * @typedef {import("../util/Options").ClientProperties} ClientProperties */ /** * @class HttpClient * @extends Client * @author 7kasper * @classdesc * A http client is backed by a request and response * object. A http client differs from websocket client * as it is restfull. All information required to do * something is contained in our single request. * We can also only handle one route and response with * this client, as any (full) response will close the * http connection. */ declare class HttpClient extends Client { /** * Makes a new HttpClient * Note that a client is handled restly * and thus for each HTTP request there * exists one client. * @param {RestNio} restnio * @param {Request} request * @param {Response} response * @param {ClientProperties} [props] - optional extra client properties. */ constructor(restnio: RestNio, request: Request, response: Response, props?: ClientProperties); url: Url.UrlWithParsedQuery; response: Response; cookies: {}; cookieOptions: import("../util/Options").CookieOptions; bin(buf: any): void; err(err: any, code?: number): void; redirect(url: any, code?: number): number; _closed: boolean; header(header: any, value: any): any; cookie(name: any, value: any, options: any): any; /** * Performs the tokencheck from header if present. * Unlike websockets which can be upgraded * http connections are RESTfull and * verified via token for each request. */ tokenCheck(): Promise; /** * Parses all headers and cookies from client. */ parseHeaderCookies(): void; /** * Finds and runs the routing from request body. */ doRoute(): void; } declare namespace HttpClient { export { RestNio, Client, ClientProperties }; } import Client = require("./Client"); import Url = require("url"); /** * Typedef Imports */ type RestNio = import("../RestNio"); /** * Typedef Imports */ type Client = import("./Client"); /** * Typedef Imports */ type ClientProperties = import("../util/Options").ClientProperties;