Skip to content
Advertisement

File Upload Using Feign – multipart/form-data

I’m trying to accomplish a multipart file upload using feign, but I can’t seem to find a good example of it anywhere. I essentially want the HTTP request to turn out similar to this:

JavaScript

Or even…

JavaScript

Do I need to manually build the request body, including generating the multipart boundaries? That seems a bit excessive considering everything else this client can do.

Advertisement

Answer

No, you don’t. You just need to define a kind of proxy interface method, specify the content-type as: multipart/form-data and other info such as parameters required by the remote API. Here is an example:

JavaScript

The completed example can be found here: File Uploading with Open Feign

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement