Skip to content

WebClient: Multipart POST doesn't work [SPR-15948] #20501

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

Closed
spring-projects-issues opened this issue Sep 10, 2017 · 7 comments
Closed

WebClient: Multipart POST doesn't work [SPR-15948] #20501

spring-projects-issues opened this issue Sep 10, 2017 · 7 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket)

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 10, 2017

Abhijit Sarkar opened SPR-15948 and commented

Using 5.0.0.BUILD-SNAPSHOT, not RC3.

I understand that #19114 added multipart support for WebClient, and I also looked at the integration tests, but sadly, it doesn't work for the following request made using WebClient.

curl -v --trace-ascii /dev/stdout -F board=sarkara1/test -F note=test -F image=@test.png "https://api.pinterest.com/v1/pins/?access_token=xxx"

I keep getting the error "400 board is required" from the server. I'm not saying Pinterest API is the best designed in the world, actually it's quite the contrary, but the above curl statement works, and so does an OkHttp client, so I've to believe that it's a bug with WebClient.

By dumping the request body, and comparing it with those from the working versions, I've noticed that WebClient adds a Content-Type: text/plain header for simple form fields like board and note above, while the other clients don't. If I remember correctly, WebClient also adds a ;utf-8 after the overall Content-Type boundary, which the other clients don't. There may be other differences that I'm failing to report now, since it was done in a caffeine-fuelled, late-night, debugging session. Also see #20500 which is adding to the differences.


Affects: 5.0 RC3

Issue Links:

0 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

Brian Clozel commented

Please update your question with the WebClient code you're using, or better, a repro project.

Even if it is useful, we can't work from your own interpretation of the issue, but rather the issue itself: what were you trying to do? what did you try to achieve that? what did happen? what did you expect to happen instead?

@spring-projects-issues
Copy link
Collaborator Author

Abhijit Sarkar commented

Looks like I somehow missed the notification, or it was never sent out, of a follow up comment. The code that's not working is here https://github.com/asarkar/spring/blob/master/pinterest-client/src/main/kotlin/org/abhijitsarkar/spring/pinterest/client/Pinterest.kt#L257. I had to use OkHttp instead because of this bug.

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

Could you please update to Spring Framework 5.0.3 and say us if the issue is still present?

@spring-projects-issues
Copy link
Collaborator Author

Abhijit Sarkar commented

This was several months ago, and I'll have to try to reproduce this error. If and when I am able to, I'll post an update.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 27, 2018

Rossen Stoyanchev commented

We had this #20793 resolved recently which might have been the reason.

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

Abhijit Sarkar Any chance you could test with Spring Framework 5.0.4 and send us your feedback?

@spring-projects-issues
Copy link
Collaborator Author

Abhijit Sarkar commented

After 6 months, I no longer remember the context, and also don't have the original code. Feel free to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket)
Projects
None yet
Development

No branches or pull requests

2 participants