customHeaders
Type: Record<string, string> | undefined
| Default: undefined
Default headers to be included in all HTTP requests made by the generated services.
TIP
We recommend using the HttpInterceptor
for setting headers — it's cleaner, more maintainable and recommended by the Angular Dev Community.
Usage
typescript
// openapi.config.ts
import { GeneratorConfig } from 'ng-openapi';
const config: GeneratorConfig = {
options: {
customHeaders: {
'X-Requested-With': 'XMLHttpRequest',
'Accept': 'application/json'
},
},
... // other configurations
};
export default config;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14