Skip to content

Commit

Permalink
refactor: Removed the confusing url parameter from BaseService
Browse files Browse the repository at this point in the history
It was interfering with an internally defined property which lead to confusion.

BREAKING CHANGE: Switching required initialization argument from 'url' to 'host'
  • Loading branch information
jdalrymple committed May 25, 2019
1 parent 3ad35f6 commit 26e2e52
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/infrastructure/BaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Request from 'request-promise';
import XMLHttpRequester, { XhrStaticPromisified } from './XMLHttpRequester';

interface BaseModelOptions {
url?: string;
public readonly url: string;
token?: string;
oauthToken?: string;
useXMLHttpRequest?: boolean;
Expand All @@ -26,12 +26,13 @@ class BaseModel {
token,
oauthToken,
sudo,
url = 'https://gitlab.com',
useXMLHttpRequest = false,
host = 'https://gitlab.com',
url = '',
version = 'v4',
rejectUnauthorized = true,
}: BaseModelContructorOptions) {
this.url = URLJoin(url, 'api', version);
}: BaseServiceOptions) {
this.url = [host, 'api', version, url].join('/');
this.headers = {};
this.requester = useXMLHttpRequest
? XMLHttpRequester : (Request as temporaryAny as XhrStaticPromisified);
Expand Down

0 comments on commit 26e2e52

Please sign in to comment.