add withCredentials to the configuration (#5484)

* add withCredentials to the configuration

1. `withCredentials` in Request is `false` default
2. if want to set the `withCredentials` as `true` (for CORS request),
 instance `Configuration` object and set the `withCredentials` as `true`.

* simplify the code according to the code review
This commit is contained in:
Xin Meng
2017-04-28 11:11:23 +01:00
committed by wing328
parent e5fdf327db
commit c7979da74d
12 changed files with 47 additions and 85 deletions

View File

@@ -205,9 +205,8 @@ export class {{classname}} {
body: formParams.toString(),
{{/hasFormParams}}
search: queryParameters,
withCredentials:true
withCredentials:this.configuration.withCredentials
});
// https://github.com/swagger-api/swagger-codegen/issues/4037
if (extraHttpRequestParams) {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);

View File

@@ -3,4 +3,5 @@ export class Configuration {
username: string;
password: string;
accessToken: string | (() => string);
withCredentials: boolean;
}