@tramvai/tinkoff-request-http-client-adapter 0.8.158 → 0.8.162
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 +4 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Interface implementation `HttpClient` from [@tramvai/http-client](references/lib
|
|
|
6
6
|
|
|
7
7
|
### createAdapter
|
|
8
8
|
|
|
9
|
-
`createAdapter` - factory to create an HTTP client
|
|
9
|
+
`createAdapter` - factory to create an HTTP client. It configures an instance of `@tinkoff/request` via `createTinkoffRequest`, and based on it creates an instance of `HttpClientAdapter`
|
|
10
10
|
|
|
11
11
|
```tsx
|
|
12
12
|
type createAdapter = (options: TinkoffRequestOptions) => HttpClient;
|
|
@@ -24,7 +24,7 @@ interface TinkoffRequestOptions extends HttpClientRequest {
|
|
|
24
24
|
disableCache?: boolean;
|
|
25
25
|
// cache factory for `@tinkoff/request-plugin-cache-memory`
|
|
26
26
|
createCache?: (options: any) => any;
|
|
27
|
-
// cache ttl
|
|
27
|
+
// cache ttl for `@tinkoff/request-plugin-cache-memory`
|
|
28
28
|
cacheTime?: number;
|
|
29
29
|
// the default request execution time limit, in ms
|
|
30
30
|
defaultTimeout?: number;
|
|
@@ -49,9 +49,7 @@ type createTinkoffRequest = (options: TinkoffRequestOptions) => MakeRequest;
|
|
|
49
49
|
|
|
50
50
|
`HttpClientAdapter` - adapts `@tinkoff/request` to the interface `HttpClient`.
|
|
51
51
|
|
|
52
|
-
The `request` method wraps the request parameters in the `modifyRequest` option, and passes them to `@tinkoff/request`.
|
|
53
|
-
Then, the received response is modified in the `HttpClientRequest`, and wrapped in the `modifyResponse` option.
|
|
54
|
-
If there is an error, it will wrapped into the `modifyError` option.
|
|
52
|
+
The `request` method wraps the request parameters in the `modifyRequest` option, and passes them to `@tinkoff/request`. Then, the received response is modified in the `HttpClientRequest`, and wrapped in the `modifyResponse` option. If there is an error, it will wrapped into the `modifyError` option.
|
|
55
53
|
|
|
56
54
|
The `fork` method creates a new instance of `HttpClientAdapter`, but with the same `@tinkoff/request` instance.
|
|
57
55
|
|
|
@@ -61,8 +59,7 @@ type HttpClientAdapter = HttpClient;
|
|
|
61
59
|
|
|
62
60
|
### mergeOptions
|
|
63
61
|
|
|
64
|
-
By default, `mergeOptions` compose `modifyRequest`, `modifyResponse` and `modifyError` options, with the corresponding options from `options` being executed first, then from `nextOptions`.
|
|
65
|
-
If you pass a third parameter `{ replace: true }`, all parameters of the same name from `options` will simply be overwritten by parameters from `nextOptions`
|
|
62
|
+
By default, `mergeOptions` compose `modifyRequest`, `modifyResponse` and `modifyError` options, with the corresponding options from `options` being executed first, then from `nextOptions`. If you pass a third parameter `{ replace: true }`, all parameters of the same name from `options` will simply be overwritten by parameters from `nextOptions`
|
|
66
63
|
|
|
67
64
|
```tsx
|
|
68
65
|
type mergeOptions = (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tinkoff-request-http-client-adapter",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.162",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@tinkoff/request-plugin-validate": "^0.8.8",
|
|
32
32
|
"@tinkoff/utils": "^2.1.2",
|
|
33
33
|
"@tramvai/http-client": "0.1.23",
|
|
34
|
-
"@tramvai/tokens-common": "1.
|
|
34
|
+
"@tramvai/tokens-common": "1.31.1",
|
|
35
35
|
"tslib": "^2.0.3"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|