Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNo example for file upload with MIME as content type #2136
Comments
|
Turns out I didn't need to do anything more complicated than call c.GetRawData() to get the bytes of my uploaded file. It may be helpful to note this with a comment in the existing examples. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Description
Using the fetch API from WHATWG in Google Chrome, an image upload does not have Content-Type multipart/form-data. Instead, the content type is set to the MIME type (ex:
image/jpeg) with aboundaryparameter. Setting Content-Type explicitly tomultipart/form-datashould result in an error (and it does).How to reproduce
Follow an existing image upload example from Gin's documentation, but use the fetch API on the client to send the upload request.
Expectations
Use for non-multipart requests should be documented, as people may try to use the fetch API with Gin.
Actual result
I still haven't figured out how to get it working. Probably gonna have to dive into how Gin works internally to figure this out.
Environment