Skip to content

Commit bdc8f44

Browse files
Kasim Ahmicmarkerikson
authored andcommitted
Add docs for httpResolverOptions
1 parent 241c6c9 commit bdc8f44

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/rtk-query/usage/code-generation.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ interface SimpleUsage {
108108
| Array<string | RegExp | EndpointMatcherFunction>
109109
endpointOverrides?: EndpointOverrides[]
110110
flattenArg?: boolean
111+
httpResolverOptions?: SwaggerParser.HTTPResolverOptions
111112
}
112113

113114
export type EndpointMatcherFunction = (
@@ -169,3 +170,24 @@ const config: ConfigFile = {
169170
},
170171
}
171172
```
173+
174+
#### Custom HTTP resolver options
175+
176+
If you need to customize the HTTP request issued to your server, you user the `httpResolverOptions` option. This object is passed directly to the `SwaggerParser` instance that fetches the OpenAPI schema.
177+
178+
For example, you can pass custom headers or set a custom request timeout.
179+
180+
```ts no-transpile title="openapi-config.ts"
181+
const config: ConfigFile = {
182+
schemaFile: 'https://petstore3.swagger.io/api/v3/openapi.json',
183+
apiFile: './src/store/emptyApi.ts',
184+
outputFile: './src/store/petApi.ts',
185+
httpResolverOptions: {
186+
timeout: 30_000,
187+
headers: {
188+
Accept: 'application/json',
189+
Authorization: 'Basic cmVkdXgtdG9vbGtpdDppcy1ncmVhdA==',
190+
},
191+
},
192+
}
193+
```

0 commit comments

Comments
 (0)