UNPKG

1.72 kBTypeScriptView Raw
1/// <reference types="express" />
2import { Context } from '@loopback/core';
3import { HandlerContext, MiddlewareContext, Request, Response } from '@loopback/express';
4import { RestServerResolvedConfig } from './rest.server';
5/**
6 * A per-request Context combining an IoC container with handler context
7 * (request, response, etc.).
8 */
9export declare class RequestContext extends MiddlewareContext implements HandlerContext {
10 readonly request: Request;
11 readonly response: Response;
12 readonly serverConfig: RestServerResolvedConfig;
13 /**
14 * Get the protocol used by the client to make the request.
15 * Please note this protocol may be different from what we are observing
16 * at HTTP/TCP level, because reverse proxies like nginx or sidecars like
17 * Envoy are switching between protocols.
18 */
19 get requestedProtocol(): string;
20 /**
21 * Get the effective base path of the incoming request. This base path
22 * combines `baseUrl` provided by Express when LB4 handler is mounted on
23 * a non-root path, with the `basePath` value configured at LB4 side.
24 */
25 get basePath(): string;
26 /**
27 * Get the base URL used by the client to make the request.
28 * This URL contains the protocol, hostname, port and base path.
29 * The path of the invoked route and query string is not included.
30 *
31 * Please note these values may be different from what we are observing
32 * at HTTP/TCP level, because reverse proxies like nginx are rewriting them.
33 */
34 get requestedBaseUrl(): string;
35 constructor(request: Request, response: Response, parent: Context, serverConfig: RestServerResolvedConfig, name?: string);
36 protected setupBindings(): void;
37}