@nxgt/httpyz 0.2.0 → 0.3.1
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/README.md +15 -0
- package/dist/chunks/index-52w12dh5.js +1051 -0
- package/dist/chunks/index-52w12dh5.js.map +25 -0
- package/dist/client/create-http-client.d.ts.map +1 -1
- package/dist/client/types.d.ts +15 -4
- package/dist/client/types.d.ts.map +1 -1
- package/dist/index.js +21 -1049
- package/dist/index.js.map +3 -19
- package/dist/integration/index.js +17 -1047
- package/dist/integration/index.js.map +3 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -383,6 +383,20 @@ outermost, and all of them run inside `retry` and `auth`, so they see each
|
|
|
383
383
|
try, with its token. A middleware's own error comes through as it is, and is
|
|
384
384
|
not retried.
|
|
385
385
|
|
|
386
|
+
`http.use()` adds middleware to a client you already have. It changes the
|
|
387
|
+
client in place, and returns it:
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
http.use(timing).use(logging);
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
- **After the chain the client has:** retry → auth → `use` → what `use()`
|
|
394
|
+
added, in order → fetch.
|
|
395
|
+
- **From then on:** a call already sent keeps the chain it started with.
|
|
396
|
+
- **Groups:** a group runs through its parent's middleware, even what is
|
|
397
|
+
added after the group was made. What is added to a group is the group's
|
|
398
|
+
alone, and its own groups'.
|
|
399
|
+
|
|
386
400
|
Headers that only need a value, such as a `traceparent` from the current
|
|
387
401
|
span, need no middleware: `headers` may be a function.
|
|
388
402
|
|
|
@@ -684,6 +698,7 @@ What `createHttpClient` returns.
|
|
|
684
698
|
| `events` | `(path: Path, ...args: EventsArgs<Path, E, Decoded>) => EventStream<StreamEvent<E, Decoded>>` | server-sent events. See [Server-sent events](#server-sent-events) |
|
|
685
699
|
| `lines` | `(path: Path, ...args: LinesArgs<Path, I, Decoded>) => Stream<StreamItem<I, Decoded>>` | JSON Lines. See [JSON Lines](#json-lines) |
|
|
686
700
|
| `group` | `() => HttpGroup` | the same client, for calls that end together. See [Cancelling](#cancelling) |
|
|
701
|
+
| `use` | `(...middlewares: Middleware[]) => this` | adds middleware to this client, in place, and returns it. See [Middleware](#middleware) |
|
|
687
702
|
|
|
688
703
|
##### `HttpGroup`
|
|
689
704
|
|