File tree Expand file tree Collapse file tree
modules/openapi-generator/src/main/resources/typescript-fetch
samples/client/petstore/typescript-fetch/builds Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,10 +52,13 @@ export class BaseAPI {
5252 const body = (context.body instanceof FormData || isBlob(context.body))
5353 ? context.body
5454 : JSON.stringify(context.body);
55+
56+ const headers = Object.assign({ } , this.configuration.headers, context.headers);
5557 const init = {
5658 method: context.method,
57- headers: context. headers,
59+ headers: headers,
5860 body,
61+ credentials: this.configuration.credentials
5962 } ;
6063 return { url, init } ;
6164 }
@@ -121,6 +124,8 @@ export interface ConfigurationParameters {
121124 password?: string; // parameter for basic security
122125 apiKey?: string | ((name: string) => string); // parameter for apiKey security
123126 accessToken?: string | ((name?: string, scopes?: string[]) => string); // parameter for oauth2 security
127+ headers?: HTTPHeaders; //header params we want to use on every request
128+ credentials?: RequestCredentials; //value for the credentials param we want to use on each request
124129}
125130
126131export class Configuration {
@@ -165,6 +170,14 @@ export class Configuration {
165170 }
166171 return undefined;
167172 }
173+
174+ get headers(): HTTPHeaders {
175+ return this.configuration.headers;
176+ }
177+
178+ get credentials(): RequestCredentials {
179+ return this.configuration.credentials;
180+ }
168181}
169182
170183export type Json = any;
Original file line number Diff line number Diff line change @@ -63,10 +63,13 @@ export class BaseAPI {
6363 const body = ( context . body instanceof FormData || isBlob ( context . body ) )
6464 ? context . body
6565 : JSON . stringify ( context . body ) ;
66+
67+ const headers = Object . assign ( { } , this . configuration . headers , context . headers ) ;
6668 const init = {
6769 method : context . method ,
68- headers : context . headers ,
70+ headers : headers ,
6971 body,
72+ credentials : this . configuration . credentials
7073 } ;
7174 return { url, init } ;
7275 }
@@ -132,6 +135,8 @@ export interface ConfigurationParameters {
132135 password ?: string ; // parameter for basic security
133136 apiKey ?: string | ( ( name : string ) => string ) ; // parameter for apiKey security
134137 accessToken ?: string | ( ( name ?: string , scopes ?: string [ ] ) => string ) ; // parameter for oauth2 security
138+ headers ?: HTTPHeaders ; //header params we want to use on every request
139+ credentials ?: RequestCredentials ; //value for the credentials param we want to use on each request
135140}
136141
137142export class Configuration {
@@ -176,6 +181,14 @@ export class Configuration {
176181 }
177182 return undefined ;
178183 }
184+
185+ get headers ( ) : HTTPHeaders {
186+ return this . configuration . headers ;
187+ }
188+
189+ get credentials ( ) : RequestCredentials {
190+ return this . configuration . credentials ;
191+ }
179192}
180193
181194export type Json = any ;
Original file line number Diff line number Diff line change @@ -63,10 +63,13 @@ export class BaseAPI {
6363 const body = ( context . body instanceof FormData || isBlob ( context . body ) )
6464 ? context . body
6565 : JSON . stringify ( context . body ) ;
66+
67+ const headers = Object . assign ( { } , this . configuration . headers , context . headers ) ;
6668 const init = {
6769 method : context . method ,
68- headers : context . headers ,
70+ headers : headers ,
6971 body,
72+ credentials : this . configuration . credentials
7073 } ;
7174 return { url, init } ;
7275 }
@@ -132,6 +135,8 @@ export interface ConfigurationParameters {
132135 password ?: string ; // parameter for basic security
133136 apiKey ?: string | ( ( name : string ) => string ) ; // parameter for apiKey security
134137 accessToken ?: string | ( ( name ?: string , scopes ?: string [ ] ) => string ) ; // parameter for oauth2 security
138+ headers ?: HTTPHeaders ; //header params we want to use on every request
139+ credentials ?: RequestCredentials ; //value for the credentials param we want to use on each request
135140}
136141
137142export class Configuration {
@@ -176,6 +181,14 @@ export class Configuration {
176181 }
177182 return undefined ;
178183 }
184+
185+ get headers ( ) : HTTPHeaders {
186+ return this . configuration . headers ;
187+ }
188+
189+ get credentials ( ) : RequestCredentials {
190+ return this . configuration . credentials ;
191+ }
179192}
180193
181194export type Json = any ;
Original file line number Diff line number Diff line change @@ -63,10 +63,13 @@ export class BaseAPI {
6363 const body = ( context . body instanceof FormData || isBlob ( context . body ) )
6464 ? context . body
6565 : JSON . stringify ( context . body ) ;
66+
67+ const headers = Object . assign ( { } , this . configuration . headers , context . headers ) ;
6668 const init = {
6769 method : context . method ,
68- headers : context . headers ,
70+ headers : headers ,
6971 body,
72+ credentials : this . configuration . credentials
7073 } ;
7174 return { url, init } ;
7275 }
@@ -132,6 +135,8 @@ export interface ConfigurationParameters {
132135 password ?: string ; // parameter for basic security
133136 apiKey ?: string | ( ( name : string ) => string ) ; // parameter for apiKey security
134137 accessToken ?: string | ( ( name ?: string , scopes ?: string [ ] ) => string ) ; // parameter for oauth2 security
138+ headers ?: HTTPHeaders ; //header params we want to use on every request
139+ credentials ?: RequestCredentials ; //value for the credentials param we want to use on each request
135140}
136141
137142export class Configuration {
@@ -176,6 +181,14 @@ export class Configuration {
176181 }
177182 return undefined ;
178183 }
184+
185+ get headers ( ) : HTTPHeaders {
186+ return this . configuration . headers ;
187+ }
188+
189+ get credentials ( ) : RequestCredentials {
190+ return this . configuration . credentials ;
191+ }
179192}
180193
181194export type Json = any ;
Original file line number Diff line number Diff line change @@ -63,10 +63,13 @@ export class BaseAPI {
6363 const body = ( context . body instanceof FormData || isBlob ( context . body ) )
6464 ? context . body
6565 : JSON . stringify ( context . body ) ;
66+
67+ const headers = Object . assign ( { } , this . configuration . headers , context . headers ) ;
6668 const init = {
6769 method : context . method ,
68- headers : context . headers ,
70+ headers : headers ,
6971 body,
72+ credentials : this . configuration . credentials
7073 } ;
7174 return { url, init } ;
7275 }
@@ -132,6 +135,8 @@ export interface ConfigurationParameters {
132135 password ?: string ; // parameter for basic security
133136 apiKey ?: string | ( ( name : string ) => string ) ; // parameter for apiKey security
134137 accessToken ?: string | ( ( name ?: string , scopes ?: string [ ] ) => string ) ; // parameter for oauth2 security
138+ headers ?: HTTPHeaders ; //header params we want to use on every request
139+ credentials ?: RequestCredentials ; //value for the credentials param we want to use on each request
135140}
136141
137142export class Configuration {
@@ -176,6 +181,14 @@ export class Configuration {
176181 }
177182 return undefined ;
178183 }
184+
185+ get headers ( ) : HTTPHeaders {
186+ return this . configuration . headers ;
187+ }
188+
189+ get credentials ( ) : RequestCredentials {
190+ return this . configuration . credentials ;
191+ }
179192}
180193
181194export type Json = any ;
Original file line number Diff line number Diff line change @@ -63,10 +63,13 @@ export class BaseAPI {
6363 const body = ( context . body instanceof FormData || isBlob ( context . body ) )
6464 ? context . body
6565 : JSON . stringify ( context . body ) ;
66+
67+ const headers = Object . assign ( { } , this . configuration . headers , context . headers ) ;
6668 const init = {
6769 method : context . method ,
68- headers : context . headers ,
70+ headers : headers ,
6971 body,
72+ credentials : this . configuration . credentials
7073 } ;
7174 return { url, init } ;
7275 }
@@ -132,6 +135,8 @@ export interface ConfigurationParameters {
132135 password ?: string ; // parameter for basic security
133136 apiKey ?: string | ( ( name : string ) => string ) ; // parameter for apiKey security
134137 accessToken ?: string | ( ( name ?: string , scopes ?: string [ ] ) => string ) ; // parameter for oauth2 security
138+ headers ?: HTTPHeaders ; //header params we want to use on every request
139+ credentials ?: RequestCredentials ; //value for the credentials param we want to use on each request
135140}
136141
137142export class Configuration {
@@ -176,6 +181,14 @@ export class Configuration {
176181 }
177182 return undefined ;
178183 }
184+
185+ get headers ( ) : HTTPHeaders {
186+ return this . configuration . headers ;
187+ }
188+
189+ get credentials ( ) : RequestCredentials {
190+ return this . configuration . credentials ;
191+ }
179192}
180193
181194export type Json = any ;
You can’t perform that action at this time.
0 commit comments