I need to provide this header
{
x-api-key: 'something'
}
to my URL in Swagger UI. But there is no documentation for this.
I'm using Angular 9 & here is my code.
const ui = SwaggerUIBundle({
dom_id: '#swagger-ui',
layout: 'BaseLayout',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
docExpansion: 'none',
operationsSorter: 'alpha'
url: 'https://petstore.swagger.io/v2/swagger.json'
});
This code worked for me:
requestInterceptor:
function (request: any) {
request.headers = {
'x-api-key': keyValue
}
return request;
}