I was wondering how can I add requestInterceptor method to Swagger used with Nestjs? I can't find anywhere how this property can be added to SwaggerModule configuration. That's how I setup swagger docs:
SwaggerModule.setup('docs', app, document, options2);
Reason I need to use requestInterceptor is that I need to add custom 'Origin' header to Swagger's "Try it out" curl request. The only way to play with it is this requestInterceptor property.
Anyone met this problem before?
Cheers.
Your options2
object can receive this method, like:
SwaggerModule.setup('docs', app, document, {
requestInterceptor: (req) => {
req.headers['Origin'] = 'your custom value'
return req
}
})
try this.