-
Notifications
You must be signed in to change notification settings - Fork 1
TA-3794: Handle outstanding issues in refactor #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2a27cb8
9abdb84
b09d375
fe3ee0a
c3f555c
6e35a81
dde3d57
307910d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,8 +31,7 @@ export class HttpClient { | |
| this.handleError(err, resolve, reject); | ||
| }) | ||
| }).catch(e => { | ||
| logger.error(e); | ||
| throw e; | ||
| throw new FatalError(e); | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -84,12 +83,18 @@ export class HttpClient { | |
| } | ||
|
|
||
| public async post(url: string, body: any): Promise<any> { | ||
| const contentType = body instanceof FormData | ||
| ? "multipart/form-data" | ||
| : "application/json;charset=utf-8"; | ||
| const requestBody = typeof body === "string" || body instanceof String || body instanceof FormData | ||
| ? body | ||
| : JSON.stringify(body) | ||
|
Comment on lines
+86
to
+91
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This methods was design to work only with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't test it. I compared the implementations between old and refactor code base, and this method looked pretty much what was required, and left it as is because it fixed the issue. We can also go back to it and use proper method |
||
| return new Promise<any>((resolve, reject) => { | ||
| this.axios.post( | ||
| this.resolveUrl(url), | ||
| typeof body === "string" || body instanceof String ? body : JSON.stringify(body), | ||
| requestBody, | ||
| { | ||
| headers: this.buildHeaders("application/json;charset=utf-8") | ||
| headers: this.buildHeaders(contentType) | ||
| } | ||
| ).then(response => { | ||
| this.handleResponse(response, resolve, reject); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.