Skip to content

Commit cdfd6fb

Browse files
committed
Docs fixes
1 parent 3ae21df commit cdfd6fb

File tree

2 files changed

+4
-41
lines changed

2 files changed

+4
-41
lines changed

Diff for: docs/openapi-fetch/api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ onRequest(req, options) {
124124
| Name | Type | Description |
125125
| :-------- | :-----------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
126126
| `req` | `MiddlewareRequest` | A standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) with `schemaPath` (OpenAPI pathname) and `params` ([params](/openapi-fetch/api#fetch-options) object) |
127-
| `options` | `MergedOptiosn` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) |
127+
| `options` | `MergedOptions` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) |
128128

129129
And it expects either:
130130

@@ -143,7 +143,7 @@ onResponse(res, options) {
143143
| Name | Type | Description |
144144
| :-------- | :-----------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
145145
| `req` | `MiddlewareRequest` | A standard [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response). |
146-
| `options` | `MergedOptiosn` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) |
146+
| `options` | `MergedOptions` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) |
147147

148148
And it expects either:
149149

Diff for: docs/openapi-fetch/middleware-auth.md

+2-39
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,14 @@ const client = createClient<paths>({ baseUrl: "https://myapi.dev/v1/" });
3333
client.use(myMiddleware);
3434
```
3535

36+
To learn more about `onRequest()` and `onResponse()` [see the API](/api#middleware)
37+
3638
::: tip
3739

3840
The order in which middleware are registered matters. For requests, `onRequest()` will be called in the order registered. For responses, `onResponse()` will be called in **reverse** order. That way the first middleware gets the first “dibs” on requests, and the final control over responses.
3941

4042
:::
4143

42-
### onRequest
43-
44-
```ts
45-
onRequest(req, options) {
46-
//
47-
}
48-
```
49-
50-
`onRequest()` takes 2 params:
51-
52-
| Name | Type | Description |
53-
| :-------- | :-----------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54-
| `req` | `MiddlewareRequest` | A standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) with `schemaPath` (OpenAPI pathname) and `params` ([params](/openapi-fetch/api#fetch-options) object) |
55-
| `options` | `MergedOptiosn` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) |
56-
57-
And it expects either:
58-
59-
- **If modifying the request:** A [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request)
60-
- **If not modifying:** `undefined` (void)
61-
62-
### onResponse
63-
64-
```ts
65-
onResponse(res, options) {
66-
//
67-
}
68-
```
69-
70-
`onResponse()` also takes 2 params:
71-
| Name | Type | Description |
72-
| :-------- | :-----------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73-
| `req` | `MiddlewareRequest` | A standard [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response). |
74-
| `options` | `MergedOptiosn` | Combination of [createClient](/openapi-fetch/api#create-client) options + [fetch overrides](/openapi-fetch/api#fetch-options) |
75-
76-
And it expects either:
77-
78-
- **If modifying the response:** A [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response)
79-
- **If not modifying:** `undefined` (void)
80-
8144
### Skipping
8245

8346
If you want to skip the middleware under certain conditions, just `return` as early as possible:

0 commit comments

Comments
 (0)