Skip to content

Commit

Permalink
Add docs for httpResolverOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasim Ahmic authored and Kasim Ahmic committed Jul 20, 2024
1 parent 42aaccd commit a762a91
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/rtk-query/usage/code-generation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ interface SimpleUsage {
| Array<string | RegExp | EndpointMatcherFunction>
endpointOverrides?: EndpointOverrides[]
flattenArg?: boolean
httpResolverOptions?: SwaggerParser.HTTPResolverOptions
}

export type EndpointMatcherFunction = (
Expand Down Expand Up @@ -169,3 +170,24 @@ const config: ConfigFile = {
},
}
```

#### Custom HTTP resolver options

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.

For example, you can pass custom headers or set a custom request timeout.

```ts no-transpile title="openapi-config.ts"
const config: ConfigFile = {
schemaFile: 'https://petstore3.swagger.io/api/v3/openapi.json',
apiFile: './src/store/emptyApi.ts',
outputFile: './src/store/petApi.ts',
httpResolverOptions: {
timeout: 30_000,
headers: {
Accept: 'application/json',
Authorization: 'Basic cmVkdXgtdG9vbGtpdDppcy1ncmVhdA==',
},
},
}
```

0 comments on commit a762a91

Please sign in to comment.