Since we're explicitly calculating the utf-8 length (as far as I can tell, this is an implicit assumption overall) when encoding JSON, I made sure to add it to the Content-Type header too.
The denormalization of the content-length header is so we don't have to do the extra work of calculating the utf8-length if we don't have to.
There is no real test structure to speak of, so I just tested the failing case before and after to ensure it succeeds.
Since we're explicitly calculating the utf-8 length (as far as I can tell, this is an implicit assumption overall) when encoding JSON, I made sure to add it to the Content-Type header too.
The denormalization of the content-length header is so we don't have to do the extra work of calculating the utf8-length if we don't have to.
There is no real test structure to speak of, so I just tested the failing case before and after to ensure it succeeds.
Closes https://github.com/joepie91/node-bhttp/issues/28