Skip to content

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

Closed

Description

@spring-projects-issues

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 [email protected] "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

Activity

  1. spring-projects-issues commented on Sep 11, 2017

    @spring-projects-issues
    CollaboratorAuthor

    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?

  2. spring-projects-issues commented on Dec 12, 2017

    @spring-projects-issues
    CollaboratorAuthor

    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.

  3. spring-projects-issues commented on Jan 26, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Sébastien Deleuze commented

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

  4. spring-projects-issues commented on Jan 27, 2018

    @spring-projects-issues
    CollaboratorAuthor

    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.

  5. spring-projects-issues commented on Jan 27, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Rossen Stoyanchev commented

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

  6. spring-projects-issues commented on Mar 26, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Sébastien Deleuze commented

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

  7. spring-projects-issues commented on Mar 28, 2018

    @spring-projects-issues
    CollaboratorAuthor

    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.

  8. added
    type: bug
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: web

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions