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

Use form-data subtype for multipart requests. #1096

Merged
merged 1 commit into from
Sep 23, 2015
Merged

Use form-data subtype for multipart requests. #1096

merged 1 commit into from
Sep 23, 2015

Conversation

lukaciko
Copy link
Contributor

Use form-data content type for multipart requests. Closes #1092.

I don't especially like how this stretches over multiple classes. Perhaps RequestBuilder should be responsible for creating the right part headers.

@JakeWharton
Copy link
Collaborator

Thanks. I'll look soon.

JakeWharton added a commit that referenced this pull request Sep 23, 2015
Use form-data subtype for multipart requests.
@JakeWharton JakeWharton merged commit b6a657a into square:master Sep 23, 2015
@TheGhoul21
Copy link

I think that the header for the Part of a file is missing the filename as well.

Part part = (Part) methodParameterAnnotation;
            com.squareup.okhttp.Headers headers = com.squareup.okhttp.Headers.of(
                "Content-Disposition", "form-data; name=\"" + part.value() + "\";filename=\"file.jpg\"",
                "Content-Transfer-Encoding", part.encoding());

This fixed at least for me

@wKovacs64
Copy link

I think e8431de only solved most of #1092. The tail end of the 3rd bullet point was left out:

and optionally also add the filename parameter

@lukaciko lukaciko deleted the multipart-form-data branch September 29, 2015 07:54
@lukaciko
Copy link
Contributor Author

The filename is required by some backend configurations. In Retrofit 1.9 you could set the filename by creating a TypedFile class, but that class doesn't exist anymore. I think it would be best if you open a new issue.

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

Successfully merging this pull request may close these issues.

4 participants