UNPKG

reblend-routing

Version:

Reblend route pattern matcher

78 lines (77 loc) 1.89 kB
/*! * express * Copyright(c) 2009-2013 TJ Holowaychuk * Copyright(c) 2013 Roman Shtylman * Copyright(c) 2014-2015 Douglas Christopher Wilson * Copyright(c) 2024 Emmanuel Paul Elom * MIT Licensed */ import IAny from './IAny'; import { Route } from './index'; /** * Request prototype. * @public */ declare class Request { url: string; params?: IAny; body?: IAny; query: IAny; baseUrl?: string; next?: Function; originalUrl?: string; route?: Route; urlObject: URL; method: string; constructor(url: string); /** * Return the value of param `name` when present or `defaultValue`. * * - Checks route placeholders, ex: _/user/:id_ * - Checks body params, ex: id=12, {"id":12} * - Checks query string params, ex: ?id=12 * * To utilize request bodies, `req.body` * should be an object. This can be done by using * the `bodyParser()` middleware. * * @param {String} name * @param {Mixed} [defaultValue] * @return {String} * @public */ param(name: string, defaultValue?: any): any; /** * Return the protocol string "http" or "https" * when requested with TLS. When the "trust proxy" * setting trusts the socket address, the * "X-Forwarded-Proto" header field will be trusted * and used if present. * * If you're running behind a reverse proxy that * supplies https for you this may be enabled. * * @return {String} * @public */ protocol(): string; /** * Short-hand for: * * req.protocol === 'https' * * @return {Boolean} * @public */ secure(): boolean; /** * Short-hand for `url.parse(req.url).pathname`. * * @return {String} * @public */ path(): string; } /** * Module exports. * @public */ export default Request;