Skip to content

Commit dc0a1a1

Browse files
committed
Add encode uri
1 parent f8e664f commit dc0a1a1

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/builder/APIConnectionBuilder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export class APIConnectionBuilder implements IConnectionBuilder {
1818
}
1919

2020
public async build(options: APIOptions & BaseCloudOptions): Promise<IConnection> {
21-
2221
const { apiUrl = "https://api2.arduino.cc/iot/v1/clients/token" } = options;
2322
const headers = { 'content-type': 'application/x-www-form-urlencoded' };
2423
const body = {

src/http/HttpClientFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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(JSON.stringify({ payload, status: response.status }));
20+
if (response.status >= 400) throw new Error(encodeURIComponent(JSON.stringify({ payload, status: response.status })));
2121
else return payload;
2222
}
2323

0 commit comments

Comments
 (0)