forked from loafle/openapi-generator-original
[typescript-angular] allow empty string basePath (#3489)
* [typescript-angular] Fixing #2731 - empty string basePath * typescript-angular: refactor base path configuration * typescript-angular: refactor base path configuration
This commit is contained in:
parent
9ca4bac881
commit
8d67acc3ed
@ -66,13 +66,14 @@ export class {{classname}} {
|
||||
{{/useHttpClient}}
|
||||
|
||||
constructor(protected {{#useHttpClient}}httpClient: HttpClient{{/useHttpClient}}{{^useHttpClient}}http: Http{{/useHttpClient}}, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
{{#useHttpClient}}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -36,13 +36,14 @@ export class PetService implements PetServiceInterface {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class StoreService implements StoreServiceInterface {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class UserService implements UserServiceInterface {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: QueryEncoder;
|
||||
|
||||
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper();
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -32,13 +32,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -91,3 +91,68 @@ describe(`API (with ConfigurationFactory)`, () => {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe(`API (with ConfigurationFactory and empty basePath)`, () => {
|
||||
let httpClient: HttpClient;
|
||||
let httpTestingController: HttpTestingController;
|
||||
|
||||
const pet: Pet = {
|
||||
name: `pet`,
|
||||
photoUrls: []
|
||||
};
|
||||
|
||||
let apiConfigurationParams: ConfigurationParameters = {
|
||||
// add configuration params here
|
||||
basePath: ''
|
||||
};
|
||||
|
||||
let apiConfig: Configuration = new Configuration(apiConfigurationParams);
|
||||
|
||||
const getApiConfig = () => {
|
||||
return apiConfig;
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule ,
|
||||
ApiModule.forRoot(getApiConfig)
|
||||
],
|
||||
providers: [
|
||||
PetService,
|
||||
]
|
||||
});
|
||||
|
||||
// Inject the http service and test controller for each test
|
||||
httpClient = TestBed.get(HttpClient);
|
||||
httpTestingController = TestBed.get(HttpTestingController);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// After every test, assert that there are no more pending requests.
|
||||
httpTestingController.verify();
|
||||
});
|
||||
|
||||
describe(`PetService`, () => {
|
||||
it(`should be provided`, () => {
|
||||
const petService = TestBed.get(PetService);
|
||||
expect(petService).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should call initially configured empty basePath /pet`, async(() => {
|
||||
const petService = TestBed.get(PetService);
|
||||
|
||||
petService.addPet(pet).subscribe(
|
||||
result => expect(result).toEqual(pet),
|
||||
error => fail(`expected a result, not the error: ${error.message}`),
|
||||
);
|
||||
|
||||
const req = httpTestingController.expectOne('/pet');
|
||||
|
||||
expect(req.request.method).toEqual('POST');
|
||||
|
||||
req.flush(pet);
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -35,13 +35,14 @@ export class PetService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class StoreService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ export class UserService {
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
|
||||
|
||||
} else {
|
||||
this.configuration.basePath = basePath || this.basePath;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user