You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ npm i @fastify/reply-from
14
14
```
15
15
16
16
## Compatibility with @fastify/multipart
17
-
`@fastify/reply-from` and [`@fastify/multipart`](https://github.com/fastify/fastify-multipart) should not be registered as sibling plugins nor should they be registered in plugins which have a parent-child relationship.`<br>` The two plugins are incompatible, in the sense that the behavior of `@fastify/reply-from` might not be the expected one when the above-mentioned conditions are not respected.`<br>` This is due to the fact that `@fastify/multipart` consumes the multipart content by parsing it, hence this content is not forwarded to the target service by `@fastify/reply-from`.`<br>`
17
+
`@fastify/reply-from` and [`@fastify/multipart`](https://github.com/fastify/fastify-multipart) should not be registered as sibling plugins nor should they be registered in plugins that have a parent-child relationship.`<br>` The two plugins are incompatible, in the sense that the behavior of `@fastify/reply-from` might not be the expected one when the above-mentioned conditions are not respected.`<br>` This is due to the fact that `@fastify/multipart` consumes the multipart content by parsing it, hence this content is not forwarded to the target service by `@fastify/reply-from`.`<br>`
18
18
However, the two plugins may be used within the same fastify instance, at the condition that they belong to disjoint branches of the fastify plugins hierarchy tree.
By default package will issue log messages when a request is received. By setting this option to true, these log messages will be disabled.
191
+
By default, the package will issue log messages when a request is received. By setting this option to true, these log messages will be disabled.
192
192
193
193
Default for `disableRequestLogging` will be `false`. To disable the log messages set `disableRequestLogging` to `true`.
194
194
@@ -206,7 +206,7 @@ The number of parsed URLs that will be cached. Default: `100`.
206
206
#### `disableCache`
207
207
208
208
This option will disable the URL caching.
209
-
This cache is dedicated to reduce the amount of URL object generation.
209
+
This cache is dedicated to reducing the amount of URL object generation.
210
210
Generating URLs is a main bottleneck of this module, please disable this cache with caution.
211
211
212
212
#### `contentTypesToEncode`
@@ -231,7 +231,7 @@ This plugin will always retry on 503 errors, _unless_ `retryMethods` does not co
231
231
232
232
#### `globalAgent`
233
233
234
-
Enables the possibility to explictly opt-in for global agents.
234
+
Enables the possibility to explicitly opt-in for global agents.
235
235
236
236
Usage for undici global agent:
237
237
@@ -274,7 +274,7 @@ By Default: `false`
274
274
275
275
This plugin will always retry on `GET` requests that returns 503 errors, _unless_`retryMethods` does not contain `GET`.
276
276
277
-
This option set the limit on how many times the plugin should retry the request, specifically for 503 errors.
277
+
This option sets the limit on how many times the plugin should retry the request, specifically for 503 errors.
278
278
279
279
By Default: 10
280
280
@@ -293,7 +293,7 @@ If a `handler` is passed to the `retryDelay` object the onus is on the client to
293
293
-`res` is the raw response returned by the underlying agent (if available) __Note__: this object is not a Fastify response, but instead the low-level response from the agent. This property may be null if no response was obtained at all, like from a connection reset or timeout.
294
294
-`attempt` in the object callback refers to the current retriesAttempt number. You are given the freedom to use this in concert with the retryCount property set to handle retries
295
295
-`getDefaultRetry` refers to the default retry handler. If this callback returns not null and you wish to handle those case of errors simply invoke it as done below.
296
-
-`retriesCount` refers to the retriesCount property a client passes to reply-from. Note if the client does not explicitly set this value it will default to 0. The objective value here is to avoid hard-coding and seeing the retriesCount set. It is your perogative to ensure that you ensure the value here is as you wish (and not `0` if not intended to be as a result of a lack of not setting it).
296
+
-`retriesCount` refers to the retriesCount property a client passes to reply-from. Note if the client does not explicitly set this value it will default to 0. The objective value here is to avoid hard-coding and seeing the retriesCount set. It is your prerogative to ensure that you ensure the value here is as you wish (and not `0` if not intended to be as a result of a lack of not setting it).
instance with a `from` method, which will reply to the original request
342
-
__from the desired source__. The options allows to override any part of
342
+
__from the desired source__. The options allows overrides of any part of
343
343
the request or response being sent or received to/from the source.
344
344
345
345
**Note: If `base` is specified in plugin options, the `source` here should not override the host/origin.**
346
346
347
347
#### `onResponse(request, reply, response)`
348
348
349
-
Called when a HTTP response is received from the source. Passed the original source `request`, the in-progress reply to the source as `reply`, and the ongoing `response` from the upstream server.
349
+
Called when an HTTP response is received from the source. Passed the original source `request`, the in-progress reply to the source as `reply`, and the ongoing `response` from the upstream server.
350
350
351
351
The default behavior is `reply.send(response.stream)`, which will be disabled if the
352
352
option is specified.
@@ -367,10 +367,10 @@ the `content-length` header.
367
367
368
368
#### `onError(reply, error)`
369
369
370
-
Called when a HTTP response is received with error from the source.
370
+
Called when an HTTP response is received with error from the source.
371
371
The default behavior is `reply.send(error)`, which will be disabled if the
372
372
option is specified.
373
-
It must reply the error.
373
+
It must reply with the error.
374
374
375
375
#### `rewriteHeaders(headers, request)`
376
376
@@ -387,7 +387,7 @@ It must return the new headers object.
387
387
388
388
#### `getUpstream(request, base)`
389
389
390
-
Called to get upstream destination, before the request is being sent. Useful when you want to decide which target server to call based on the request data.
390
+
Called to get upstream destination, before the request is sent. Useful when you want to decide which target server to call based on the request data.
391
391
Helpful for a gradual rollout of new services.
392
392
Parameters are the Fastify request and the base string from the plugin options.
0 commit comments