Skip to content

Commit ee5c876

Browse files
committed
Remove useless stringify
1 parent 9490c9a commit ee5c876

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/http/HttpClientFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class HttpClientFactory {
66
public static Create(fetch: Fetch): IHttpClient {
77
return new class implements IHttpClient {
88
post<T, P>(uri: string, body: P, headers?: { [key: string]: string; }): Promise<T> {
9-
return this.execute(uri, 'post', JSON.stringify(body), headers);
9+
return this.execute(uri, 'post', body, headers);
1010
}
1111

1212
private async execute<T>(url: string, method: string, body?: any, headers?: { [key: string]: string; }): Promise<T> {
@@ -17,7 +17,7 @@ export class HttpClientFactory {
1717
const contentType = responseHeaders['content-type'] || '';
1818
const payload = contentType.match('json') && !!text ? JSON.parse(text) : text;
1919

20-
if (response.status >= 400) throw new Error(encodeURIComponent(JSON.stringify({ payload, status: response.status })));
20+
if (response.status >= 400) throw new Error(JSON.stringify({ payload, status: response.status }));
2121
else return payload;
2222
}
2323

0 commit comments

Comments
 (0)