Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post form-data not support customized headers #8203

Open
charleshuangcai opened this issue Mar 20, 2020 · 6 comments
Open

post form-data not support customized headers #8203

charleshuangcai opened this issue Mar 20, 2020 · 6 comments

Comments

@charleshuangcai
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@charleshuangcai
Copy link
Author

image
when post form-data, i want to add some headers for each part, but it only has "key", "value", and "content-type"

@codenirvana
Copy link
Member

@charleshuangcai currently you can only configure a custom content-type for each part. The rest of the headers are added automatically based on the type when the request is sent.

Can you tell more about your use-case and what are these additional headers which you want to include?

@charleshuangcai
Copy link
Author

In mine case, i want to add more fields in content-disposition except 'name' and 'filename' to identify the file metadata. In addition, content-md5 is available. Looking forward the new feature!

@markhowells
Copy link

I need to be able to add a Content-Transfer-Encoding header to an uploaded file signify that the image file is base64 encoded ...

@Antonhansel
Copy link

Hello @codenirvana

I'm facing the same issue when using Google Apis upload methods where sending metadata along the content is required, for example: https://developers.google.com/display-video/api/guides/how-tos/upload#multipart
As explained in the doc, two content-type headers need to be set for different parts of the request.

POST /upload/farm/v1/animals?uploadType=multipart HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer your_auth_token
Content-Type: multipart/related; boundary=foo_bar_baz
Content-Length: number_of_bytes_in_entire_request_body

--foo_bar_baz
Content-Type: application/json; charset=UTF-8

{
  "name": "Llama"
}

--foo_bar_baz
Content-Type: image/jpeg

JPEG data
--foo_bar_baz--

Thank you for your time.

@giridharvc7 giridharvc7 assigned giridharvc7 and unassigned vvs11 Jul 29, 2021
@hrancic
Copy link

hrancic commented Aug 29, 2022

It would be great to have the option to specify Content-Length header for each of the multi part parts, for example like in the following curl (imagine I am sending two files: meta_file and data_file)
curl -X POST <endpoint> -F"meta_file=@meta-file;headers=\"Content-Length: 123\"" -F"data_file=@data-file;headers=\"Content-Length: 123456\""

Should I open a separate issue for this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

7 participants