import Response$1 from "./response.js"; import Context$1 from "./context.js"; import { Application } from "../../lib/application.js"; import { Request as Request$1 } from "@eggjs/core"; //#region src/app/extend/request.d.ts export default class Request extends Request$1 { app: Application; ctx: Context$1; response: Response$1; /** * Request body, parsed from koa-bodyparser or @eggjs/multipart */ body: any; /** * Parse the "Host" header field host * and support X-Forwarded-Host when a * proxy is enabled. * @member {String} Request#host * @example * ip + port * ```js * this.request.host * => '127.0.0.1:7001' * ``` * or domain * ```js * this.request.host * => 'demo.eggjs.org' * ``` */ get host(): string; /** * @member {String} Request#protocol * @example * ```js * this.request.protocol * => 'https' * ``` */ get protocol(): string; /** * Get all pass through ip addresses from the request. * Enable only on `app.config.proxy = true` * * @member {Array} Request#ips * @example * ```js * this.request.ips * => ['100.23.1.2', '201.10.10.2'] * ``` */ get ips(): string[]; /** * Get the request remote IPv4 address * @member {String} Request#ip * @return {String} IPv4 address * @example * ```js * this.request.ip * => '127.0.0.1' * => '111.10.2.1' * ``` */ get ip(): string; /** * Set the request remote IPv4 address * @member {String} Request#ip * @param {String} ip - IPv4 address * @example * ```js * this.request.ip * => '127.0.0.1' * => '111.10.2.1' * ``` */ set ip(ip: string); /** * detect if response should be json * 1. url path ends with `.json` * 2. response type is set to json * 3. detect by request accept header * * @member {Boolean} Request#acceptJSON * @since 1.0.0 */ get acceptJSON(): boolean; _customQuery(cacheName: symbol, filter: (value: string | string[]) => string | string[]): Record; /** * get params pass by querystring, all values are of string type. * @member {Object} Request#query * @example * ```js * GET http://127.0.0.1:7001?name=Foo&age=20&age=21 * this.query * => { 'name': 'Foo', 'age': '20' } * * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val * this.query * => * { * "a": "b", * "o[foo]": "bar", * "b[]": "1", * "e": "val" * } * ``` */ get query(): Record; /** * get params pass by querystring, all value are Array type. {@link Request#query} * @member {Array} Request#queries * @example * ```js * GET http://127.0.0.1:7001?a=b&a=c&o[foo]=bar&b[]=1&b[]=2&e=val * this.queries * => * { * "a": ["b", "c"], * "o[foo]": ["bar"], * "b[]": ["1", "2"], * "e": ["val"] * } * ``` */ get queries(): Record; /** * Set query-string as an object. * * @function Request#query * @param {Object} obj set querystring and query object for request. */ set query(obj: Record); } //#endregion