UNPKG

@mojojs/core

Version:

Real-time web framework

75 lines (74 loc) 1.69 kB
import type { ServerRequestOptions } from '../types.js'; import { Params } from '../body/params.js'; import { Body } from '../body.js'; /** * Server request class. */ export declare class ServerRequest extends Body { /** * Request base path. */ basePath: string; /** * Check if underlying socket was encrypted with TLS. */ isSecure: boolean; /** * Request is a WebSocket handshake. */ isWebSocket: boolean; /** * Request method. */ method: string | null; /** * Request path. */ path: string; /** * Peer address. */ remoteAddress: string | null; /** * Request ID. */ requestId: string; /** * Reverse proxy support is activated. */ reverseProxy: boolean; /** * Request URL. */ url: string | null; _cookies: Record<string, string> | undefined; _ip: string | null | undefined; _protocol: string | undefined; _query: Params | undefined; _userinfo: string | null | undefined; constructor(options: ServerRequestOptions); /** * Server base URL. */ get baseURL(): string; /** * Get cookie value. */ getCookie(name: string): string | null; /** * Remote IP address. Uses he `X-Forwarded-For` header value if reverse proxy support is activated. */ get ip(): string | null; /** * Request protocol. Uses the `X-Forwarded-Proto` header value if reverse proxy support is activated. */ get protocol(): string; /** * Query parameters. */ get query(): Params; /** * User info. */ get userinfo(): string | null; }