150
rated 0 times
[
151]
[
1]
/ answers: 1 / hits: 21030
/ 11 Years ago, mon, july 29, 2013, 12:00:00
I'm not at all sure whether my current method of calculating the content-length is correct. What are the implications of using string.length() to calculate the content-length. Does setting the charset to utf-8 even mean anything when using node.js?
payload = JSON.stringify( payload );
response.header( 'content-type', application/json; charset=utf-8 );
response.header( 'content-length', payload.length );
response.end( payload );
More From » node.js