|
| 1 | +> **[@poppinss/http-server](../README.md)** |
| 2 | +
|
| 3 | +[Globals](../README.md) / ["HttpContext/index"](../modules/_httpcontext_index_.md) / [HttpContext](_httpcontext_index_.httpcontext.md) / |
| 4 | + |
| 5 | +# Class: HttpContext |
| 6 | + |
| 7 | +Http context is passed to all route handlers, middleware, |
| 8 | +error handler and server hooks. |
| 9 | + |
| 10 | +## Hierarchy |
| 11 | + |
| 12 | +* **HttpContext** |
| 13 | + |
| 14 | +## Implements |
| 15 | + |
| 16 | +* [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md) |
| 17 | + |
| 18 | +## Index |
| 19 | + |
| 20 | +### Constructors |
| 21 | + |
| 22 | +* [constructor](_httpcontext_index_.httpcontext.md#constructor) |
| 23 | + |
| 24 | +### Properties |
| 25 | + |
| 26 | +* [logger](_httpcontext_index_.httpcontext.md#logger) |
| 27 | +* [params](_httpcontext_index_.httpcontext.md#optional-params) |
| 28 | +* [request](_httpcontext_index_.httpcontext.md#request) |
| 29 | +* [response](_httpcontext_index_.httpcontext.md#response) |
| 30 | +* [route](_httpcontext_index_.httpcontext.md#optional-route) |
| 31 | +* [subdomains](_httpcontext_index_.httpcontext.md#optional-subdomains) |
| 32 | + |
| 33 | +### Methods |
| 34 | + |
| 35 | +* [create](_httpcontext_index_.httpcontext.md#static-create) |
| 36 | + |
| 37 | +## Constructors |
| 38 | + |
| 39 | +### constructor |
| 40 | + |
| 41 | +\+ **new HttpContext**(`request`: `RequestContract`, `response`: `ResponseContract`, `logger`: `LoggerContract`): *[HttpContext](_httpcontext_index_.httpcontext.md)* |
| 42 | + |
| 43 | +**Parameters:** |
| 44 | + |
| 45 | +Name | Type | |
| 46 | +------ | ------ | |
| 47 | +`request` | `RequestContract` | |
| 48 | +`response` | `ResponseContract` | |
| 49 | +`logger` | `LoggerContract` | |
| 50 | + |
| 51 | +**Returns:** *[HttpContext](_httpcontext_index_.httpcontext.md)* |
| 52 | + |
| 53 | +## Properties |
| 54 | + |
| 55 | +### logger |
| 56 | + |
| 57 | +• **logger**: *`LoggerContract`* |
| 58 | + |
| 59 | +*Implementation of [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md).[logger](../interfaces/_contracts_.httpcontextcontract.md#logger)* |
| 60 | + |
| 61 | +___ |
| 62 | + |
| 63 | +### `Optional` params |
| 64 | + |
| 65 | +• **params**? : *any* |
| 66 | + |
| 67 | +*Implementation of [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md).[params](../interfaces/_contracts_.httpcontextcontract.md#optional-params)* |
| 68 | + |
| 69 | +___ |
| 70 | + |
| 71 | +### request |
| 72 | + |
| 73 | +• **request**: *`RequestContract`* |
| 74 | + |
| 75 | +*Implementation of [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md).[request](../interfaces/_contracts_.httpcontextcontract.md#request)* |
| 76 | + |
| 77 | +___ |
| 78 | + |
| 79 | +### response |
| 80 | + |
| 81 | +• **response**: *`ResponseContract`* |
| 82 | + |
| 83 | +*Implementation of [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md).[response](../interfaces/_contracts_.httpcontextcontract.md#response)* |
| 84 | + |
| 85 | +___ |
| 86 | + |
| 87 | +### `Optional` route |
| 88 | + |
| 89 | +• **route**? : *[RouteNode](../modules/_contracts_.md#routenode)‹*this*›* |
| 90 | + |
| 91 | +*Implementation of [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md).[route](../interfaces/_contracts_.httpcontextcontract.md#optional-route)* |
| 92 | + |
| 93 | +___ |
| 94 | + |
| 95 | +### `Optional` subdomains |
| 96 | + |
| 97 | +• **subdomains**? : *any* |
| 98 | + |
| 99 | +*Implementation of [HttpContextContract](../interfaces/_contracts_.httpcontextcontract.md).[subdomains](../interfaces/_contracts_.httpcontextcontract.md#optional-subdomains)* |
| 100 | + |
| 101 | +## Methods |
| 102 | + |
| 103 | +### `Static` create |
| 104 | + |
| 105 | +▸ **create**(`routePattern`: string, `routeParams`: any, `req?`: `IncomingMessage`, `res?`: `ServerResponse`, `serverConfig?`: [ServerConfigContract](../modules/_contracts_.md#serverconfigcontract)): *[HttpContext](_httpcontext_index_.httpcontext.md)* |
| 106 | + |
| 107 | +Creates a new fake context instance for a given route. |
| 108 | + |
| 109 | +**Parameters:** |
| 110 | + |
| 111 | +Name | Type | |
| 112 | +------ | ------ | |
| 113 | +`routePattern` | string | |
| 114 | +`routeParams` | any | |
| 115 | +`req?` | `IncomingMessage` | |
| 116 | +`res?` | `ServerResponse` | |
| 117 | +`serverConfig?` | [ServerConfigContract](../modules/_contracts_.md#serverconfigcontract) | |
| 118 | + |
| 119 | +**Returns:** *[HttpContext](_httpcontext_index_.httpcontext.md)* |
0 commit comments