Closed thakkaryash94 closed 5 years ago
Sounds like this is working as intended, it should be returning streams. Up to the app how to handle it.
I think it suppose to return fields also. Is while loop is compulsory,
while ((part = await ctx.request.parts)) {
part.resume()
}
only await ctx.request.parts
isn't working, I have to loop it.
Please post a failing test I can run so I can help debug when I get a chance
The problem may be related the one I was having in trying to access non-stream data parts - which in :autofields mode should appear on ctx.request.parts.field (object) and .fields (array). The problem I encountered was that these attributes are incrementally added as the while loop proceeds, and can really only be sensibly accessed after it's completion. When I turned off :autofields mode, I was able to process the non-stream parts sequentially as the loop executed, which for me is far preferable. Unfortunately, the current code mandates that autofields be true, and provides no facility to override it. I could try put a pull request together to allow it to be overridden. Should I?
You can disable autoFields by setting validate.multipartOptions.autoFields: false
. I've updated the docs
Multipart request not returning proper
ctx.request.parts
object. returnsFileStream
object without path key which contains file temp path and form-data key-values are also not returning. I tried async-busboy. works fine with the same request. It returns {files, fields}, if you say, I can take a chance to migrate from await-busboy to async-busboy.