Open KaustubhPatange opened 6 months ago
https://github.com/golang/go/blob/master/src/mime/multipart/formdata.go#L124
because if the field name is empty, will be skip.
by the way, if you want to solve it, you can parse body data by yourself, reference to the following https://github.com/golang/go/blob/master/src/mime/multipart/formdata.go#L41
We fixed it by refactoring all code to have a "key". But looking at this it would've made more sense to writing a custom parse body function.
Thanks for this.
We're are migrating one of our micro-services written in NodeJS Javascript which handles all things related to upload into Go, thinking to use gin framework. However I've noticed a few things when doing a multipart upload.
Following is the basic code implementation
curl --location '0.0.0.0:8081/upload' \ --form 'file=@"/Users/name/Downloads/test.pdf"'
,map[file:[0x14000194ea0]]
curl --location '0.0.0.0:8081/upload' \ --form '=@"/Users/devel/Downloads/Profile.pdf"'
,map[]
To my surprise it seems that when the "key" is not provided it fails to parse the form body. We did not face this issue with our current implementation in NodeJs Fastify framework, where
request.file()
gives you the first file in the multipart request.Is there a way in Gin which has such similar effect, maybe grouping by form boundary?