eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
753 stars 133 forks source link

Functions _isUTF8 and _isJSON should consider the presence of text charset=... in the header #202

Closed triadium closed 4 years ago

triadium commented 4 years ago

Code:

response.writeHead(200, { 'Content-Type': 'application/json;charset=utf-8' });
response.end(JSON.stringify(data)); // 'utf8' - default value

Expected values: response._isJSON() == true response._isUTF8() == true

Actual values: response._isJSON() == false response._isUTF8() == false

github-actions[bot] commented 4 years ago

Stale issue message