Refit 2.3.0
What's New
Multipart uploads (#146, thanks @mteper)
Methods decorated with Multipart
attribute will be submitted with multipart content type.
At this time, multipart methods support the following parameter types:
- string (parameter name will be used as name and string value as value)
- byte array
- Stream
- FileInfo
For byte array and Stream parameters, use AttachmentName
parameter attribute to specify the
name for the attachment. For FileInfo
parameters, the file name will be used.
public interface ISomeApi
{
[Multipart]
[Post("/users/{id}/photo")]
Task UploadPhoto(int id, [AttachmentName("photo.jpg")] Stream stream);
}
New Features
- HttpContent can now be returned or used as a parameter, and it will be used as the body (#104, thanks @onovotny)