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

Multipart file parts without Content-Type #535

Open
moll opened this issue May 17, 2024 · 3 comments
Open

Multipart file parts without Content-Type #535

moll opened this issue May 17, 2024 · 3 comments

Comments

@moll
Copy link

moll commented May 17, 2024

Hey,

Thanks for your continued maintenance of HttpClient!

I've been using the Multipart functionality in Network.HTTP.Client.MultipartFormData and noticed it insists on setting the Content-Type of a file part, derived from its file extension. Would you consider disabling that or giving a way to unset it? I'd like to use custom content-types or even leave them out.

Perhaps if the implementation set a default header in the Part constructor instead of a separate Part field, it'd be more general to also overwrite via a hypothetical modifyHeaders accessor. Seems a tad odd for that header to be special-cased in the first place.

Thanks!

@snoyberg
Copy link
Owner

I've never tried this, but it looks like partContentType can be set to Nothing.

@moll
Copy link
Author

moll commented May 19, 2024

If I'm not mistaken, that won't be possible if the constructor is not exported in https://github.com/snoyberg/http-client/blob/6f742e857a91b37f9d1618a30510fc4f97989342/http-client/Network/HTTP/Client/MultipartFormData.hs. I think I saw in a mention of making the constructor private in a pre 2015 issue somewhere to permit easier implementation changes without affecting the API.

@snoyberg
Copy link
Owner

Please see https://www.yesodweb.com/book/settings-types, it’s still possible to set these fields.

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

No branches or pull requests

2 participants