Skip to content

Commit

Permalink
fix: use constant defined by generated sdks for url (#77)
Browse files Browse the repository at this point in the history
this fixes a bug in which generated sdk code would not actually use the default url if none was provided
  • Loading branch information
dpopp07 committed Jan 16, 2020
1 parent 16fdf87 commit cb3cc81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/base-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export interface BaseServiceOptions extends UserOptions {
* them to the service endpoint.
*/
export class BaseService {
static URL: string;
static DEFAULT_SERVICE_URL: string;
static DEFAULT_SERVICE_NAME: string;
protected baseOptions: BaseServiceOptions;
private authenticator: AuthenticatorInterface;
private requestWrapperInstance;
Expand Down Expand Up @@ -108,7 +109,7 @@ export class BaseService {

const serviceClass = this.constructor as typeof BaseService;
this.baseOptions = extend(
{ qs: {}, serviceUrl: serviceClass.URL },
{ qs: {}, serviceUrl: serviceClass.DEFAULT_SERVICE_URL },
options,
_options
);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/base-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,5 @@ function setupFakeService() {
util.inherits(TestService, BaseService);
TestService.prototype.name = DEFAULT_NAME;
TestService.prototype.version = 'v1';
TestService.URL = DEFAULT_URL;
TestService.DEFAULT_SERVICE_URL = DEFAULT_URL;
}

0 comments on commit cb3cc81

Please sign in to comment.