Is your feature request related to a problem? Please describe.
When having a form data parameter, e.g.:
{
"name": "file",
"required": true,
"in": "formData",
"description": "",
"type": "file"
}
the generated API simply takes a Buffer object. However, I think it would be nice to support the other request options, especially the one to pass meta data along with the file (also see the example on https://github.com/request/request in the 'multipart/form-data (Multipart Form Uploads)' section).
When downloading a file the generated API seems to ignores the produces swagger spec, e.g. when using:
"produces": [
"application/octet-stream"
],
the request is done with application/json (or am I doing something wrong?)
Describe the solution you'd like
This is how I currently do the file upload and download:
const part = {
value: Buffer.from('Test file content'),
options: {
filename: 'filename'
}
}
const putResponse = await api.filePut(part as any);
const getResponse = await api.filesGet(putResponse.body.uri,
{
headers: {
Accept: 'application/octet-stream'
}
});
There are two hacks here:
- the
part object is cast to any because the api expect a Buffer (it works anyway)
- the
Accept: 'application/octet-stream' header must be passed in manually
Is your feature request related to a problem? Please describe.
When having a form data parameter, e.g.:
the generated API simply takes a Buffer object. However, I think it would be nice to support the other request options, especially the one to pass meta data along with the file (also see the example on https://github.com/request/request in the 'multipart/form-data (Multipart Form Uploads)' section).
When downloading a file the generated API seems to ignores the
producesswagger spec, e.g. when using:the request is done with
application/json(or am I doing something wrong?)Describe the solution you'd like
This is how I currently do the file upload and download:
There are two hacks here:
partobject is cast to any because the api expect a Buffer (it works anyway)Accept: 'application/octet-stream'header must be passed in manually