Skip to content

Commit 657fa5e

Browse files
amirai21asafgardin
authored andcommitted
feat: makeFormDataRequest - change type and disable lint
1 parent ceaa9e9 commit 657fa5e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/APIClient.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,19 @@ export abstract class APIClient {
7171
);
7272
}
7373

74-
protected makeFormDataRequest<Req>(
75-
path: string,
76-
filePath: string,
77-
opts?: RequestOptions<Req>,
78-
): FinalRequestOptions {
74+
protected makeFormDataRequest<Req>(path: string, filePath: string, opts?: RequestOptions<Req>): FinalRequestOptions {
7975
const formData = new FormData();
8076
const fileStream = createReadStream(filePath);
8177
const fileName = getBasename(filePath);
8278

8379
formData.append('file', fileStream, fileName);
8480

8581
if (opts?.body) {
86-
const body = opts.body as Record<string, string>;
82+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
83+
const body = opts.body as Record<string, any>;
8784
for (const [key, value] of Object.entries(body)) {
8885
if (Array.isArray(value)) {
89-
value.forEach((item) => formData.append(key, item));
86+
value.forEach(item => formData.append(key, item));
9087
} else {
9188
formData.append(key, value);
9289
}
@@ -95,12 +92,12 @@ export abstract class APIClient {
9592

9693
const headers = {
9794
...opts?.headers,
98-
'Content-Type': `multipart/form-data; boundary=${formData.getBoundary()}`,
95+
'Content-Type': `multipart/form-data; boundary=${formData.getBoundary()}`
9996
};
10097
console.log(headers);
101-
console.log('-------------------------');
98+
console.log("-------------------------");
10299
console.log(formData.getHeaders());
103-
console.log('-------------------------');
100+
console.log("-------------------------");
104101

105102
const options: FinalRequestOptions = {
106103
method: 'post',

0 commit comments

Comments
 (0)