fastify 3.21.5 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/build-validation.js +4 -0
- package/docs/Ecosystem.md +1 -0
- package/docs/Hooks.md +2 -2
- package/docs/Recommendations.md +55 -19
- package/docs/Request.md +1 -1
- package/docs/Server.md +27 -3
- package/docs/TypeScript.md +3 -0
- package/docs/Validation-and-Serialization.md +10 -2
- package/fastify.d.ts +15 -0
- package/fastify.js +3 -1
- package/lib/configValidator.js +498 -433
- package/lib/decorate.js +9 -5
- package/lib/reply.js +8 -3
- package/lib/request.js +13 -4
- package/lib/server.js +7 -0
- package/package.json +3 -4
- package/test/bundler/README.md +7 -7
- package/test/decorator.test.js +6 -8
- package/test/internals/initialConfig.test.js +4 -0
- package/test/internals/reply.test.js +1 -1
- package/test/internals/request.test.js +47 -0
- package/test/maxRequestsPerSocket.test.js +104 -0
- package/test/reply-error.test.js +28 -0
- package/test/requestTimeout.test.js +50 -0
- package/test/schema-special-usage.test.js +1 -1
- package/test/stream.test.js +2 -2
- package/test/types/content-type-parser.test-d.ts +1 -1
- package/test/types/fastify.test-d.ts +15 -0
- package/test/types/instance.test-d.ts +1 -1
- package/test/types/logger.test-d.ts +1 -1
- package/test/types/register.test-d.ts +13 -1
- package/types/register.d.ts +2 -1
|
@@ -15,6 +15,8 @@ const ajv = new Ajv({
|
|
|
15
15
|
const defaultInitOptions = {
|
|
16
16
|
connectionTimeout: 0, // 0 sec
|
|
17
17
|
keepAliveTimeout: 5000, // 5 sec
|
|
18
|
+
maxRequestsPerSocket: 0, // no limit
|
|
19
|
+
requestTimeout: 0, // no limit
|
|
18
20
|
bodyLimit: 1024 * 1024, // 1 MiB
|
|
19
21
|
caseSensitive: true,
|
|
20
22
|
disableRequestLogging: false,
|
|
@@ -47,6 +49,8 @@ const schema = {
|
|
|
47
49
|
properties: {
|
|
48
50
|
connectionTimeout: { type: 'integer', default: defaultInitOptions.connectionTimeout },
|
|
49
51
|
keepAliveTimeout: { type: 'integer', default: defaultInitOptions.keepAliveTimeout },
|
|
52
|
+
maxRequestsPerSocket: { type: 'integer', default: defaultInitOptions.maxRequestsPerSocket, nullable: true },
|
|
53
|
+
requestTimeout: { type: 'integer', default: defaultInitOptions.requestTimeout },
|
|
50
54
|
bodyLimit: { type: 'integer', default: defaultInitOptions.bodyLimit },
|
|
51
55
|
caseSensitive: { type: 'boolean', default: defaultInitOptions.caseSensitive },
|
|
52
56
|
http2: { type: 'boolean' },
|
package/docs/Ecosystem.md
CHANGED
|
@@ -187,6 +187,7 @@ Plugins maintained by the Fastify team are listed under [Core](#core) while plug
|
|
|
187
187
|
- [`fastify-sse`](https://github.com/lolo32/fastify-sse) to provide Server-Sent Events with `reply.sse( … )` to Fastify.
|
|
188
188
|
- [`fastify-sse-v2`](https://github.com/nodefactoryio/fastify-sse-v2) to provide Server-Sent Events using Async Iterators (supports newer versions of Fastify).
|
|
189
189
|
- [`fastify-stripe`](https://github.com/coopflow/fastify-stripe) Plugin to initialize and encapsulate [Stripe Node.js](https://github.com/stripe/stripe-node) instances in Fastify.
|
|
190
|
+
- [`fastify-supabase`](https://github.com/coopflow/fastify-supabase) Plugin to initialize and encapsulate [Supabase](https://github.com/supabase/supabase-js) instances in Fastify.
|
|
190
191
|
- [`fastify-tls-keygen`](https://gitlab.com/sebdeckers/fastify-tls-keygen) Automatically generate a browser-compatible, trusted, self-signed, localhost-only, TLS certificate.
|
|
191
192
|
- [`fastify-tokenize`](https://github.com/Bowser65/fastify-tokenize) [Tokenize](https://github.com/Bowser65/Tokenize) plugin for Fastify that removes the pain of managing authentication tokens, with built-in integration for `fastify-auth`.
|
|
192
193
|
- [`fastify-totp`](https://github.com/heply/fastify-totp) A plugin to handle TOTP (e.g. for 2FA).
|
package/docs/Hooks.md
CHANGED
|
@@ -90,7 +90,7 @@ If you are using the `preValidation` hook, you can change the payload before it
|
|
|
90
90
|
|
|
91
91
|
```js
|
|
92
92
|
fastify.addHook('preValidation', (request, reply, done) => {
|
|
93
|
-
|
|
93
|
+
request.body = { ...request.body, importantKey: 'randomString' }
|
|
94
94
|
done()
|
|
95
95
|
})
|
|
96
96
|
```
|
|
@@ -98,7 +98,7 @@ Or `async/await`:
|
|
|
98
98
|
```js
|
|
99
99
|
fastify.addHook('preValidation', async (request, reply) => {
|
|
100
100
|
const importantKey = await generateRandomString()
|
|
101
|
-
|
|
101
|
+
request.body = { ...request.body, importantKey }
|
|
102
102
|
})
|
|
103
103
|
```
|
|
104
104
|
|
package/docs/Recommendations.md
CHANGED
|
@@ -166,62 +166,94 @@ backend static-backend
|
|
|
166
166
|
### Nginx
|
|
167
167
|
|
|
168
168
|
```nginx
|
|
169
|
+
# This upstream block groups 3 servers into one named backend fastify_app
|
|
170
|
+
# with 2 primary servers distributed via round-robin
|
|
171
|
+
# and one backup which is used when the first 2 are not reachable
|
|
172
|
+
# This also assumes your fastify servers are listening on port 80.
|
|
173
|
+
# more info: http://nginx.org/en/docs/http/ngx_http_upstream_module.html
|
|
169
174
|
upstream fastify_app {
|
|
170
|
-
# more info: http://nginx.org/en/docs/http/ngx_http_upstream_module.html
|
|
171
175
|
server 10.10.11.1:80;
|
|
172
176
|
server 10.10.11.2:80;
|
|
173
177
|
server 10.10.11.3:80 backup;
|
|
174
178
|
}
|
|
175
179
|
|
|
180
|
+
# This server block asks NGINX to respond with a redirect when
|
|
181
|
+
# an incoming request from port 80 (typically plain HTTP), to
|
|
182
|
+
# the same request URL but with HTTPS as protocol.
|
|
183
|
+
# This block is optional, and usually used if you are handling
|
|
184
|
+
# SSL termination in NGINX, like in the example here.
|
|
176
185
|
server {
|
|
177
|
-
# default server
|
|
186
|
+
# default server is a special parameter to ask NGINX
|
|
187
|
+
# to set this server block to the default for this address/port
|
|
188
|
+
# which in this case is any address and port 80
|
|
178
189
|
listen 80 default_server;
|
|
179
190
|
listen [::]:80 default_server;
|
|
180
191
|
|
|
181
|
-
#
|
|
192
|
+
# With a server_name directive you can also ask NGINX to
|
|
193
|
+
# use this server block only with matching server name(s)
|
|
182
194
|
# listen 80;
|
|
183
195
|
# listen [::]:80;
|
|
184
196
|
# server_name example.tld;
|
|
185
197
|
|
|
198
|
+
# This matches all paths from the request and responds with
|
|
199
|
+
# the redirect mentioned above.
|
|
186
200
|
location / {
|
|
187
201
|
return 301 https://$host$request_uri;
|
|
188
202
|
}
|
|
189
203
|
}
|
|
190
204
|
|
|
205
|
+
# This server block asks NGINX to respond to requests from
|
|
206
|
+
# port 443 with SSL enabled and accept HTTP/2 connections.
|
|
207
|
+
# This is where the request is then proxied to the fastify_app
|
|
208
|
+
# server group via port 3000.
|
|
191
209
|
server {
|
|
192
|
-
#
|
|
210
|
+
# This listen directive asks NGINX to accept requests
|
|
211
|
+
# coming to any address, port 443, with SSL, and HTTP/2
|
|
212
|
+
# if possible.
|
|
193
213
|
listen 443 ssl http2 default_server;
|
|
194
214
|
listen [::]:443 ssl http2 default_server;
|
|
195
|
-
|
|
196
|
-
#
|
|
215
|
+
|
|
216
|
+
# With a server_name directive you can also ask NGINX to
|
|
217
|
+
# use this server block only with matching server name(s)
|
|
197
218
|
# listen 443 ssl http2;
|
|
198
219
|
# listen [::]:443 ssl http2;
|
|
199
220
|
# server_name example.tld;
|
|
200
221
|
|
|
201
|
-
#
|
|
222
|
+
# Your SSL/TLS certificate (chain) and secret key in the PEM format
|
|
202
223
|
ssl_certificate /path/to/fullchain.pem;
|
|
203
224
|
ssl_certificate_key /path/to/private.pem;
|
|
204
|
-
ssl_trusted_certificate /path/to/chain.pem;
|
|
205
225
|
|
|
206
|
-
#
|
|
226
|
+
# A generic best practice baseline for based
|
|
227
|
+
# on https://ssl-config.mozilla.org/
|
|
207
228
|
ssl_session_timeout 1d;
|
|
208
229
|
ssl_session_cache shared:FastifyApp:10m;
|
|
209
230
|
ssl_session_tickets off;
|
|
210
|
-
|
|
211
|
-
#
|
|
231
|
+
|
|
232
|
+
# This tells NGINX to only accept TLS 1.3, which should be fine
|
|
233
|
+
# with most modern browsers including IE 11 with certain updates.
|
|
234
|
+
# If you want to support older browsers you might need to add
|
|
235
|
+
# additional fallback protocols.
|
|
212
236
|
ssl_protocols TLSv1.3;
|
|
213
237
|
ssl_prefer_server_ciphers off;
|
|
214
|
-
|
|
215
|
-
#
|
|
238
|
+
|
|
239
|
+
# This adds a header that tells browsers to only ever use HTTPS
|
|
240
|
+
# with this server.
|
|
216
241
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
217
|
-
|
|
218
|
-
#
|
|
242
|
+
|
|
243
|
+
# The following directives are only necessary if you want to
|
|
244
|
+
# enable OCSP Stapling.
|
|
219
245
|
ssl_stapling on;
|
|
220
246
|
ssl_stapling_verify on;
|
|
247
|
+
ssl_trusted_certificate /path/to/chain.pem;
|
|
221
248
|
|
|
222
|
-
#
|
|
249
|
+
# Custom nameserver to resolve upstream server names
|
|
223
250
|
# resolver 127.0.0.1;
|
|
224
|
-
|
|
251
|
+
|
|
252
|
+
# This section matches all paths and proxies it to the backend server
|
|
253
|
+
# group specified above. Note the additional headers that forward
|
|
254
|
+
# information about the original request. You might want to set
|
|
255
|
+
# trustProxy to the address of your NGINX server so the X-Forwarded
|
|
256
|
+
* fields are used by fastify.
|
|
225
257
|
location / {
|
|
226
258
|
# more info: http://nginx.org/en/docs/http/ngx_http_proxy_module.html
|
|
227
259
|
proxy_http_version 1.1;
|
|
@@ -232,8 +264,12 @@ server {
|
|
|
232
264
|
proxy_set_header X-Real-IP $remote_addr;
|
|
233
265
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
234
266
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
235
|
-
|
|
236
|
-
|
|
267
|
+
|
|
268
|
+
# This is the directive that proxies requests to the specified server.
|
|
269
|
+
# If you are using an upstream group, then you do not need to specify a port.
|
|
270
|
+
# If you are directly proxying to a server e.g.
|
|
271
|
+
# proxy_pass http://127.0.0.1:3000 then specify a port.
|
|
272
|
+
proxy_pass http://fastify_app;
|
|
237
273
|
}
|
|
238
274
|
}
|
|
239
275
|
```
|
package/docs/Request.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Request
|
|
4
4
|
The first parameter of the handler function is `Request`.<br>
|
|
5
5
|
Request is a core Fastify object containing the following fields:
|
|
6
|
-
- `query` - the parsed querystring, its format is specified by [`querystringParser`](Server.md#
|
|
6
|
+
- `query` - the parsed querystring, its format is specified by [`querystringParser`](Server.md#querystringparser)
|
|
7
7
|
- `body` - the body
|
|
8
8
|
- `params` - the params matching the URL
|
|
9
9
|
- [`headers`](#headers) - the headers getter and setter
|
package/docs/Server.md
CHANGED
|
@@ -12,6 +12,8 @@ document describes the properties available in that options object.
|
|
|
12
12
|
- [https](./Server.md#https)
|
|
13
13
|
- [connectionTimeout](./Server.md#connectiontimeout)
|
|
14
14
|
- [keepAliveTimeout](./Server.md#keepalivetimeout)
|
|
15
|
+
- [maxRequestsPerSocket](./Server.md#maxRequestsPerSocket)
|
|
16
|
+
- [requestTimeout](./Server.md#requestTimeout)
|
|
15
17
|
- [ignoreTrailingSlash](./Server.md#ignoretrailingslash)
|
|
16
18
|
- [maxParamLength](./Server.md#maxparamlength)
|
|
17
19
|
- [onProtoPoisoning](./Server.md#onprotopoisoning)
|
|
@@ -25,7 +27,7 @@ document describes the properties available in that options object.
|
|
|
25
27
|
- [genReqId](./Server.md#genreqid)
|
|
26
28
|
- [trustProxy](./Server.md#trustProxy)
|
|
27
29
|
- [pluginTimeout](./Server.md#plugintimeout)
|
|
28
|
-
- [querystringParser](./Server.md#
|
|
30
|
+
- [querystringParser](./Server.md#querystringparser)
|
|
29
31
|
- [exposeHeadRoutes](./Server.md#exposeheadroutes)
|
|
30
32
|
- [constraints](./Server.md#constraints)
|
|
31
33
|
- [return503OnClosing](./Server.md#return503onclosing)
|
|
@@ -82,6 +84,28 @@ is in use. Also, when `serverFactory` option is specified, this option is ignore
|
|
|
82
84
|
|
|
83
85
|
+ Default: `5000` (5 seconds)
|
|
84
86
|
|
|
87
|
+
<a name="factory-max-requests-per-socket"></a>
|
|
88
|
+
### `maxRequestsPerSocket`
|
|
89
|
+
|
|
90
|
+
Defines the maximum number of requests socket can handle before closing keep alive connection. See documentation for
|
|
91
|
+
[`server.maxRequestsPerSocket` property](https://nodejs.org/dist/latest/docs/api/http.html#http_server_maxrequestspersocket)
|
|
92
|
+
to understand the effect of this option. This option only applies when HTTP/1.1
|
|
93
|
+
is in use. Also, when `serverFactory` option is specified, this option is ignored.
|
|
94
|
+
> At the time of this writing, only node version greater or equal to 16.10.0 support this option. Check the Node.js documentation for availability in the version you are running.
|
|
95
|
+
|
|
96
|
+
+ Default: `0` (no limit)
|
|
97
|
+
|
|
98
|
+
<a name="factory-request-timeout"></a>
|
|
99
|
+
### `requestTimeout`
|
|
100
|
+
|
|
101
|
+
Defines the maximum number of milliseconds for receiving the entire request from the client.
|
|
102
|
+
[`server.requestTimeout` property](https://nodejs.org/dist/latest/docs/api/http.html#http_server_requesttimeout)
|
|
103
|
+
to understand the effect of this option. Also, when `serverFactory` option is specified, this option is ignored.
|
|
104
|
+
It must be set to a non-zero value (e.g. 120 seconds) to protect against potential Denial-of-Service attacks in case the server is deployed without a reverse proxy in front.
|
|
105
|
+
> At the time of this writing, only node version greater or equal to 14.11.0 support this option. Check the Node.js documentation for availability in the version you are running.
|
|
106
|
+
|
|
107
|
+
+ Default: `0` (no limit)
|
|
108
|
+
|
|
85
109
|
<a name="factory-ignore-slash"></a>
|
|
86
110
|
### `ignoreTrailingSlash`
|
|
87
111
|
|
|
@@ -298,7 +322,7 @@ fastify.get('/user/:username', (request, reply) => {
|
|
|
298
322
|
Please note that setting this option to `false` goes against
|
|
299
323
|
[RFC3986](https://tools.ietf.org/html/rfc3986#section-6.2.2.1).
|
|
300
324
|
|
|
301
|
-
Also note, this setting will not affect query strings. If you want to change the way query strings are handled take a look at [`querystringParser`](./Server.md#
|
|
325
|
+
Also note, this setting will not affect query strings. If you want to change the way query strings are handled take a look at [`querystringParser`](./Server.md#querystringparser).
|
|
302
326
|
|
|
303
327
|
<a name="factory-request-id-header"></a>
|
|
304
328
|
### `requestIdHeader`
|
|
@@ -468,7 +492,7 @@ Configure the Ajv v6 instance used by Fastify without providing a custom one.
|
|
|
468
492
|
const fastify = require('fastify')({
|
|
469
493
|
ajv: {
|
|
470
494
|
customOptions: {
|
|
471
|
-
nullable: false // Refer to [ajv options](https://ajv
|
|
495
|
+
nullable: false // Refer to [ajv options](https://github.com/ajv-validator/ajv/tree/v6#options)
|
|
472
496
|
},
|
|
473
497
|
plugins: [
|
|
474
498
|
require('ajv-merge-patch'),
|
package/docs/TypeScript.md
CHANGED
|
@@ -35,6 +35,9 @@ This example will get you up and running with Fastify and TypeScript. It results
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
|
+
|
|
39
|
+
*Note: Set `target` property in `tsconfig.json` to `es2017` or greater to avoid [FastifyDeprecation](https://github.com/fastify/fastify/issues/3284) warning.*
|
|
40
|
+
|
|
38
41
|
3. Initialize a TypeScript configuration file:
|
|
39
42
|
```bash
|
|
40
43
|
npx tsc --init
|
|
@@ -10,6 +10,10 @@ Fastify uses a schema-based approach, and even if it is not mandatory we recomme
|
|
|
10
10
|
> user-provided schemas. See [Ajv](https://npm.im/ajv) and
|
|
11
11
|
> [fast-json-stringify](https://npm.im/fast-json-stringify) for more
|
|
12
12
|
> details.
|
|
13
|
+
>
|
|
14
|
+
> Moreover, the [`$async` Ajv feature](https://ajv.js.org/guide/async-validation.html) should not be used as part of the first validation strategy.
|
|
15
|
+
> This option is used to access Databases and reading them during the validation process may lead to Denial of Service Attacks to your
|
|
16
|
+
> application. If you need to run `async` tasks, use [Fastify's hooks](./Hooks.md) instead after validation completes, such as `preHandler`.
|
|
13
17
|
|
|
14
18
|
|
|
15
19
|
### Core concepts
|
|
@@ -257,7 +261,7 @@ curl -X GET "http://localhost:3000/?ids=1
|
|
|
257
261
|
|
|
258
262
|
You can also specify a custom schema validator for each parameter type (body, querystring, params, headers).
|
|
259
263
|
|
|
260
|
-
For example, the following code disable type
|
|
264
|
+
For example, the following code disable type coercion only for the `body` parameters, changing the ajv default options:
|
|
261
265
|
|
|
262
266
|
```js
|
|
263
267
|
const schemaCompilers = {
|
|
@@ -642,6 +646,7 @@ fastify.setErrorHandler(function (error, request, reply) {
|
|
|
642
646
|
```
|
|
643
647
|
|
|
644
648
|
If you want custom error response in schema without headaches and quickly, you can take a look at [`ajv-errors`](https://github.com/epoberezkin/ajv-errors). Check out the [example](https://github.com/fastify/example/blob/HEAD/validation-messages/custom-errors-messages.js) usage.
|
|
649
|
+
> Make sure to install version 1.0.1 of `ajv-errors`, because later versions of it are not compatible with AJV v6 (the version shipped by Fastify v3).
|
|
645
650
|
|
|
646
651
|
Below is an example showing how to add **custom error messages for each property** of a schema by supplying custom AJV options.
|
|
647
652
|
Inline comments in the schema below describe how to configure it to show a different error message for each case:
|
|
@@ -649,7 +654,10 @@ Inline comments in the schema below describe how to configure it to show a diffe
|
|
|
649
654
|
```js
|
|
650
655
|
const fastify = Fastify({
|
|
651
656
|
ajv: {
|
|
652
|
-
customOptions: {
|
|
657
|
+
customOptions: {
|
|
658
|
+
jsonPointers: true,
|
|
659
|
+
allErrors: true // Warning: Enabling this option may lead to this security issue https://www.cvedetails.com/cve/CVE-2020-8192/
|
|
660
|
+
},
|
|
653
661
|
plugins: [
|
|
654
662
|
require('ajv-errors')
|
|
655
663
|
]
|
package/fastify.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { FastifySchemaValidationError } from './types/schema'
|
|
|
15
15
|
import { ConstructorAction, ProtoAction } from "./types/content-type-parser";
|
|
16
16
|
import { Socket } from 'net'
|
|
17
17
|
import { Options as FJSOptions } from 'fast-json-stringify'
|
|
18
|
+
import { ValidatorCompiler } from '@fastify/ajv-compiler'
|
|
19
|
+
import { FastifySerializerCompiler } from './types/schema';
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Fastify factory function for the standard fastify http, https, or http2 server instance.
|
|
@@ -95,6 +97,8 @@ export type FastifyServerOptions<
|
|
|
95
97
|
ignoreTrailingSlash?: boolean,
|
|
96
98
|
connectionTimeout?: number,
|
|
97
99
|
keepAliveTimeout?: number,
|
|
100
|
+
maxRequestsPerSocket?: number,
|
|
101
|
+
requestTimeout?: number,
|
|
98
102
|
pluginTimeout?: number,
|
|
99
103
|
bodyLimit?: number,
|
|
100
104
|
maxParamLength?: number,
|
|
@@ -126,6 +130,17 @@ export type FastifyServerOptions<
|
|
|
126
130
|
constraints?: {
|
|
127
131
|
[name: string]: ConstraintStrategy<FindMyWayVersion<RawServer>, unknown>,
|
|
128
132
|
},
|
|
133
|
+
schemaController?: {
|
|
134
|
+
bucket?: (parentSchemas?: unknown) => {
|
|
135
|
+
addSchema(schema: unknown): FastifyInstance;
|
|
136
|
+
getSchema(schemaId: string): unknown;
|
|
137
|
+
getSchemas(): Record<string, unknown>;
|
|
138
|
+
};
|
|
139
|
+
compilersFactory?: {
|
|
140
|
+
buildValidator?: ValidatorCompiler;
|
|
141
|
+
buildSerializer?: (externalSchemas: unknown, serializerOptsServerOption: FastifyServerOptions["serializerOpts"]) => FastifySerializerCompiler<unknown>;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
129
144
|
return503OnClosing?: boolean,
|
|
130
145
|
ajv?: {
|
|
131
146
|
customOptions?: AjvOptions,
|
package/fastify.js
CHANGED
|
@@ -132,6 +132,8 @@ function fastify (options) {
|
|
|
132
132
|
// Update the options with the fixed values
|
|
133
133
|
options.connectionTimeout = options.connectionTimeout || defaultInitOptions.connectionTimeout
|
|
134
134
|
options.keepAliveTimeout = options.keepAliveTimeout || defaultInitOptions.keepAliveTimeout
|
|
135
|
+
options.maxRequestsPerSocket = options.maxRequestsPerSocket || defaultInitOptions.maxRequestsPerSocket
|
|
136
|
+
options.requestTimeout = options.requestTimeout || defaultInitOptions.requestTimeout
|
|
135
137
|
options.logger = logger
|
|
136
138
|
options.genReqId = genReqId
|
|
137
139
|
options.requestIdHeader = requestIdHeader
|
|
@@ -420,7 +422,7 @@ function fastify (options) {
|
|
|
420
422
|
// If the server is not ready yet, this
|
|
421
423
|
// utility will automatically force it.
|
|
422
424
|
function inject (opts, cb) {
|
|
423
|
-
// lightMyRequest is dynamically
|
|
425
|
+
// lightMyRequest is dynamically loaded as it seems very expensive
|
|
424
426
|
// because of Ajv
|
|
425
427
|
if (lightMyRequest === undefined) {
|
|
426
428
|
lightMyRequest = require('light-my-request')
|