ijpiantanida / talkback

A simple HTTP proxy that records and playbacks requests
MIT License
284 stars 41 forks source link

Fixed malformed data from utf-8 JSON Content-Length #24

Closed rmtsrc closed 5 years ago

rmtsrc commented 5 years ago

Closes #23

When content-length is set in the proxied response headers and the JSON body contains utf-8 characters the content-length send back to the client is incorrectly calculated (as json.length does not count the extra bits in a utf-8 characters).

This PR fixes the the content-length calculation for JSON responses and sends back the correct byteLength to clients. For more examples see #23.