Skip to content

Commit d68e935

Browse files
amirai21asafgardin
authored andcommitted
feat: remove log
1 parent 657fa5e commit d68e935

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/APIClient.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,17 @@ export abstract class APIClient {
6464
return this.makeRequest('delete', path, opts);
6565
}
6666

67-
upload<Req, Rsp>(path: string, filePath: string, opts?: RequestOptions<Req>): Promise<Rsp> {
67+
async upload<Req, Rsp>(path: string, filePath: string, opts?: RequestOptions<Req>): Promise<Rsp> {
6868
const formDataRequest = this.makeFormDataRequest(path, filePath, opts);
69-
return this.performRequest(formDataRequest).then(
70-
(response) => this.fetch.handleResponse<Rsp>(response) as Rsp,
71-
);
69+
const response = await this.performRequest(formDataRequest);
70+
return this.fetch.handleResponse<Rsp>(response) as Rsp;
7271
}
7372

74-
protected makeFormDataRequest<Req>(path: string, filePath: string, opts?: RequestOptions<Req>): FinalRequestOptions {
73+
protected makeFormDataRequest<Req>(
74+
path: string,
75+
filePath: string,
76+
opts?: RequestOptions<Req>,
77+
): FinalRequestOptions {
7578
const formData = new FormData();
7679
const fileStream = createReadStream(filePath);
7780
const fileName = getBasename(filePath);
@@ -83,7 +86,7 @@ export abstract class APIClient {
8386
const body = opts.body as Record<string, any>;
8487
for (const [key, value] of Object.entries(body)) {
8588
if (Array.isArray(value)) {
86-
value.forEach(item => formData.append(key, item));
89+
value.forEach((item) => formData.append(key, item));
8790
} else {
8891
formData.append(key, value);
8992
}
@@ -92,12 +95,8 @@ export abstract class APIClient {
9295

9396
const headers = {
9497
...opts?.headers,
95-
'Content-Type': `multipart/form-data; boundary=${formData.getBoundary()}`
98+
'Content-Type': `multipart/form-data; boundary=${formData.getBoundary()}`,
9699
};
97-
console.log(headers);
98-
console.log("-------------------------");
99-
console.log(formData.getHeaders());
100-
console.log("-------------------------");
101100

102101
const options: FinalRequestOptions = {
103102
method: 'post',

0 commit comments

Comments
 (0)