File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/generators/templates/partials Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @povio/openapi-codegen-cli" ,
3- "version" : " 1.2.8 " ,
3+ "version" : " 1.2.9 " ,
44 "main" : " ./dist/index.js" ,
55 "bin" : {
66 "openapi-codegen" : " ./dist/sh.js"
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ export const {{queryName endpoint mutation=true}} = (options?: AppMutationOption
1414
1515 if (file && uploadInstructions.url) {
1616 const method = (data?.method?.toLowerCase() ?? "put") as 'put' | 'post';
17+ let dataToSend: File | FormData = file;
18+ if (method === "post") {
19+ dataToSend = new FormData();
20+ dataToSend.append('file', file);
21+ if (uploadInstructions.fields) {
22+ for (const [key, value] of uploadInstructions.fields) {
23+ dataToSend.append(key, value);
24+ }
25+ }
26+ }
1727 await axios[method](uploadInstructions.url, file, {
1828 headers: {
1929 "Content-Type": file.type,
You can’t perform that action at this time.
0 commit comments