Skip to content

Commit

Permalink
Merge pull request #1 from trgwii/bugfix
Browse files Browse the repository at this point in the history
Fix global config leak, simplify promise code
  • Loading branch information
Ardalan Amini authored Nov 20, 2018
2 parents 9e44672 + 69ac006 commit 9166dbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Kutt {
*/
public static setDomain = (domain?: string) => CONFIG.DOMAIN = domain;

protected _config = CONFIG;
protected _config = { ...CONFIG };

protected _request(method: string, path: string, callback: Kutt.Callback<any>): void;
protected _request(method: string, path: string, data?: object): Promise<any>;
Expand All @@ -106,7 +106,7 @@ class Kutt {
});

if (!callback) {
return new Promise((resolve, rejects) => request.then(response => resolve(response.data)).catch(rejects));
return request.then(response => response.data);
}

request
Expand Down

0 comments on commit 9166dbb

Please sign in to comment.