diff --git a/lib/response.js b/lib/response.js index 1bda677..10e9dec 100644 --- a/lib/response.js +++ b/lib/response.js @@ -120,7 +120,7 @@ module.exports = { // string if ('string' == typeof val) { - if (setType) this.type = ~val.indexOf('<') ? 'html' : 'text'; + if (setType) this.type = /^\s*Tobi'; + assert('text/html; charset=utf-8' == res.header['content-type']); + }) + }) + }) + + describe('when an xml string is given', function(){ + it('should default to html', function(){ + /** + * This test is to show that we're not going + * to be stricter with the html sniff + * or that we will sniff other string types. + * You should `.type=` if this simple test fails. + */ + + var res = response(); + res.body = '\n<俄语>данные'; + assert('text/html; charset=utf-8' == res.header['content-type']); + }) }) describe('when a stream is given', function(){