# Interface HttpRequest

An HttpRequest is stack allocated and only accessible during the callback invocation.

interface HttpRequest {
forEach(cb: (key: string, value: string) => void): void;
getCaseSensitiveMethod(): string;
getHeader(lowerCaseKey: RecognizedString): string;
getMethod(): string;
getParameter(index: number | RecognizedString): string;
getQuery(): string;
getQuery(key: string): string;
getUrl(): string;
setYield(_yield: boolean): HttpRequest;
}

- Defined in index.d.ts:252

##### Index

### Methods

forEach
getCaseSensitiveMethod
getHeader
getMethod
getParameter
getQuery
getUrl
setYield

## Methods

### forEach

- forEach(cb: (key: string, value: string) => void): void

  Loops over all headers.

  #### Parameters

  - cb: (key: string, value: string) => void

  #### Returns void

  - Defined in index.d.ts:268

### getCaseSensitiveMethod

- getCaseSensitiveMethod(): string

  Returns the HTTP method as-is.

  #### Returns string

  - Defined in index.d.ts:262

### getHeader

- getHeader(lowerCaseKey: RecognizedString): string

  Returns the lowercased header value or empty string.

  #### Parameters

  - lowerCaseKey: RecognizedString

  #### Returns string

  - Defined in index.d.ts:254

### getMethod

- getMethod(): string

  Returns the lowercased HTTP method, useful for "any" routes.

  #### Returns string

  - Defined in index.d.ts:260

### getParameter

- getParameter(index: number | RecognizedString): string

  Returns the parsed parameter at index. Corresponds to route. Can also take the name of the parameter.

  #### Parameters

  - index: number | RecognizedString

  #### Returns string

  - Defined in index.d.ts:256

### getQuery

- getQuery(): string

  Returns the raw querystring (the part of URL after ? sign) or empty string.

  #### Returns string

  - Defined in index.d.ts:264
- getQuery(key: string): string

  Returns a decoded query parameter value or undefined.

  #### Parameters

  - key: string

  #### Returns string

  - Defined in index.d.ts:266

### getUrl

- getUrl(): string

  Returns the URL including initial /slash

  #### Returns string

  - Defined in index.d.ts:258

### setYield

- setYield(_yield: boolean): HttpRequest

  Setting yield to true is to say that this route handler did not handle the route, causing the router to continue looking for a matching route handler, or fail.

  #### Parameters

  - _yield: boolean

  #### Returns HttpRequest

  - Defined in index.d.ts:270