1

I am having an issue with my open feign client uploading documents to a backend API. I have been able to upload a document successfully using Postman, but when I use the exact same settings on my open feign client, the uploaded pdf becomes corrupted and cannot be opened.

  @RequestLine("POST /url")
  @Headers({
    "Content-type: x-www-form-urlencoded",
  })
  DocumentUpload uploadDocument(@Param("string") String string, @Param("file") File file);

The url, content type, and parameters are all the same in Postman, and as far as I can tell, there are no other settings that I am missing. Has anyone had similar issues or have ideas on what to troubleshoot? Of note, I have tried different content types (eg multipart/form-data) and they fail similarly.

Keifer
  • 165
  • 1
  • 2
  • 11
  • https://stackoverflow.com/questions/31752779/file-upload-using-feign-multipart-form-data especially "name" and content-type – Joop Eggen May 02 '18 at 15:10
  • Yes I saw that post previously when I was searching for answers. – Keifer May 02 '18 at 15:17
  • As `string` is for the PDF file name only, the `file` is of interest. You need to access and check its content in both cases. – Joop Eggen May 02 '18 at 15:22
  • Oh I see what you're saying. That string param is just mocked in my example. I have three string params in the actual code that specify things for the API I am talking to. But I do not have a param for the actual filename. Is that necessary somehow? – Keifer May 02 '18 at 16:06
  • I must admit, that ot hers are more experienced with feign. Still no answer; good luck. – Joop Eggen May 02 '18 at 21:13

0 Answers0