how to calculate Content-Length (external API)

Hi everyone,

I need to POST a JSON object to an external API but I am getting a 411 (length required).

I tried a simple hack of pushing Content-Length: 0 into the headers array, but the external API doesn't want to let me off easy, so I think I have to calculate the actual length of the object.

How do I do this?

Any help appreciated!
Working with APIs
7 replies