karlvr / openapi-generator-plus-generators

Other
21 stars 8 forks source link

multipart/form-data missing boundary #37

Open tfilo opened 2 years ago

tfilo commented 2 years ago

Hello, i have following openapi specification and trying to generate api using @openapi-generator-plus/typescript-fetch-client-generator": "^1.4.0" :

"requestBody": {
     "content": {
        "multipart/form-data": {
            "schema": {
                 "type": "object",
                 "required": ["file"],
                "properties": {
                    "file": {
                         "type": "string",
                        "format": "binary"
                   }
                }
              }
          }
       },
       "required": true
   },
}

When I am uploading picture, i have problem to process it with multer in node.js. I get error Multipart: Boundary not found and when I inspect request in browser, there is header with following content type: content-type: multipart/form-data

but when I comment out line localVarHeaderParameter.set('Content-Type', 'multipart/form-data'); in generated api.ts than browser add automatically correct header:

Content-Type: multipart/form-data; boundary=---------------------------100249134216970869883614643436

Is it possible somehow force this openapi generator to not include problematic line with localVarHeaderParameter.set('Content-Type', 'multipart/form-data'); or somehow fix to to include boundary information too ?

Thank you.