6

I have a REST request that accepts multipart/form-data. This request is already working with an Angular front-end. It expects both an array of files in a parameter called files[] and a JSON body in a parameter with the name body. In Paw, it seems like I can get the multipart files to be recognized by my endpoint but the body doesn't appear to be the correct content type (application/json). Is there any way to specify the content type for each part of a multipart POST in Paw?

Details:

The error message I'm getting on the server-side is:

org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/octet-stream' not supported

The config for the body in Paw is:

enter image description here

Danny Dainton
  • 23,069
  • 6
  • 67
  • 80
Chris Williams
  • 11,647
  • 15
  • 60
  • 97

1 Answers1

0

Years have passed and no answer has been posted when I just asked myself the same question.

Here is the answer for the next ones!:

To send a json, just use the {JSON} annotation to format JSON strings inline.

enter image description here

This will not only format your JSON, but the correct content-type will be sent during the request.

Jedupont
  • 401
  • 1
  • 4
  • 12