0

I am trying to send a post request though an api. The call requires:

content-type: multipart/form-data; boundary=[boundary_number]

I have used Charles HTTP proxy to watch see what headers/content I need to send.

charles

My Request: (basically copied from Charles' multipart section)

--324a08fa-6b58-424a-a1ad-691123d9d04b
Content-Disposition: form-data; name="message[body]"
Content-Transfer-Encoding: binary
Content-Type: text/plain; charset=utf-8
Content-Length: 5

Text!
--324a08fa-6b58-424a-a1ad-691123d9d04b--

postman

** My Headers:** headers

My Result:

When I post this in postman, the response just displays 'Loading'

I can't seem to satisfy the content I was wondering if anyone can point me in the right direction.

Any help would be greatly appreciated! Cheers!

lacking-cypher
  • 483
  • 4
  • 16

1 Answers1

0

The response is not as expected because the Content-Length of HTTP request body is incorrect. It should be 240, not 238.

For HTTP request in Charles screenshot, the message[body] data is qqq, which is also indicated by Content-Length: 3. However, in your HTTP request in postman, the message[body] data is Text!. While its own Content-length is correct (5), the Content-length of the whole request body is not changed accordingly -- it's still 238, which should be increased to 240.

shaochuancs
  • 15,342
  • 3
  • 54
  • 62