1
Answer

Question about Angular Typescript API with Swagger Codegen

Bilal K.

Bilal K.

5y
1.3k
1
Hello!

In our app, we use Swagger Codegen to generate Typescript Angular API, and we use it the same way as described in this article: https://www.c-sharpcorner.com/blogs/generate-angulartypescript-api-client-with-swagger-codegen by Naveen.

I have a question regarding setting header.
This is how we're doing it:
  1. this.fooService.defaultHeaders = new HttpHeaders({
       HeaderName: this.headerValue
    });

    this.fooService.getBar(...[values]).subscribe(...)

My question is whether there is a way to set headers different, where the first part doesn't have to be repeated everytime we call the service.

Our hope was there maybe there exists a way to say:

  1. this.fooService.getBar(...[values], ...[Options]).subscribe(...)  
The issue is that out backend specifically requests that the value needed comes as a headers. 


Thank you for your help!
 
Answers (1)