Skip to content

Commit

Permalink
feat(api-client) HttpOptions usage of reportProgress & withCredentials
Browse files Browse the repository at this point in the history
* Fixes #45
reportProgress & withCredentials are set from constructor now if available.

* automated tests for #45
  • Loading branch information
resistancecanyon authored and vmasek committed May 6, 2018
1 parent 0899b92 commit 9014a3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion templates/ngx-service.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class APIClient {

this.options = {
headers: options && options.headers ? options.headers : new HttpHeaders(),
params: options && options.params ? options.params : new HttpParams()
params: options && options.params ? options.params : new HttpParams(),
...(options && options.reportProgress ? { reportProgress: options.reportProgress } : {}),
...(options && options.withCredentials ? { withCredentials: options.withCredentials } : {})
};
}

Expand Down
4 changes: 3 additions & 1 deletion tests/esquare/api/api-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export class APIClient {

this.options = {
headers: options && options.headers ? options.headers : new HttpHeaders(),
params: options && options.params ? options.params : new HttpParams()
params: options && options.params ? options.params : new HttpParams(),
...(options && options.reportProgress ? { reportProgress: options.reportProgress } : {}),
...(options && options.withCredentials ? { withCredentials: options.withCredentials } : {})
};
}

Expand Down
4 changes: 3 additions & 1 deletion tests/gcloud-firestore/api/api-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export class APIClient {

this.options = {
headers: options && options.headers ? options.headers : new HttpHeaders(),
params: options && options.params ? options.params : new HttpParams()
params: options && options.params ? options.params : new HttpParams(),
...(options && options.reportProgress ? { reportProgress: options.reportProgress } : {}),
...(options && options.withCredentials ? { withCredentials: options.withCredentials } : {})
};
}

Expand Down
4 changes: 3 additions & 1 deletion tests/github/api/api-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export class APIClient {

this.options = {
headers: options && options.headers ? options.headers : new HttpHeaders(),
params: options && options.params ? options.params : new HttpParams()
params: options && options.params ? options.params : new HttpParams(),
...(options && options.reportProgress ? { reportProgress: options.reportProgress } : {}),
...(options && options.withCredentials ? { withCredentials: options.withCredentials } : {})
};
}

Expand Down

0 comments on commit 9014a3e

Please sign in to comment.