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

Add support for OkHttp's MultipartBody.Part. #1666

Merged
merged 1 commit into from
Mar 10, 2016

Conversation

JakeWharton
Copy link
Member

To do this we need to make @Part's value (i.e., name) optional, since MultipartBody.Part brings its name.

MultipartBody.Part is a replacement for Retrofit 1's TypedOutput/TypedFile for doing uploads of files with names.

Closes #1140. Closes #1467.

To do this we need to make `@Part`'s value (i.e., name) optional, since `MultipartBody.Part` brings its name.

`MultipartBody.Part` is a replacement for Retrofit 1's `TypedOutput`/`TypedFile` for doing uploads of files with names.
retrofit.requestBodyConverter(type, annotations, methodAnnotations);
return new ParameterHandler.Part<>(headers, converter);
Headers headers =
Headers.of("Content-Disposition", "form-data; name=\"" + partName + "\"",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to eventually restrict this to not contain ", etc.
Or escape it somehow

swankjesse added a commit that referenced this pull request Mar 10, 2016
Add support for OkHttp's MultipartBody.Part.
@swankjesse swankjesse merged commit 4e1b171 into master Mar 10, 2016
* <li>Other object types will be converted to an appropriate representation by using
* {@linkplain Converter a converter}.</li>
* {@linkplain Converter a converter}. Supply the part name in the annotation (e.g.,
* {@code @Part("foo") RequestBody foo}).</li>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be RequestBody ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. 210be05

@JakeWharton JakeWharton deleted the jw/multipart-part-parts branch September 17, 2016 23:49
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.

3 participants