Comparing version 6.8.0 to 6.8.1
@@ -176,3 +176,6 @@ /*global unescape, btoa, atob, JSON*/ | ||
this._unchunkedBody = this.body; | ||
if (this.isJson && typeof this._unchunkedBody !== 'undefined' && (typeof Buffer === 'undefined' || !Buffer.isBuffer(this._unchunkedBody))) { | ||
if ( | ||
((this.isJson && typeof this._unchunkedBody !== 'undefined') || this._unchunkedBody && typeof this._unchunkedBody === 'object') && | ||
(typeof Buffer === 'undefined' || !Buffer.isBuffer(this._unchunkedBody)) | ||
) { | ||
try { | ||
@@ -179,0 +182,0 @@ this._unchunkedBody = JSON.stringify(this._unchunkedBody); |
{ | ||
"name": "messy", | ||
"version": "6.8.0", | ||
"version": "6.8.1", | ||
"description": "Object model for HTTP and RFC822 messages", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -889,4 +889,4 @@ /*global describe, it*/ | ||
it('should support passing a JSON body as an object despite a non-JSON Content-Type', function () { | ||
expect(new Message({ | ||
describe('with a JSON body provided as an object despite a non-JSON Content-Type', function () { | ||
var message = new Message({ | ||
headers: { | ||
@@ -898,8 +898,16 @@ 'Content-Type': 'application/octet-stream' | ||
} | ||
}).toString(), 'to equal', | ||
'Content-Type: application/octet-stream\r\n' + | ||
'\r\n' + | ||
'{"foo":123}' | ||
); | ||
}); | ||
it('should stringify correctly', function () { | ||
expect(message.toString(), 'to equal', | ||
'Content-Type: application/octet-stream\r\n' + | ||
'\r\n' + | ||
'{"foo":123}' | ||
); | ||
}); | ||
it('should have the correct unchunkedBody', function () { | ||
expect(message.unchunkedBody.toString('utf-8'), 'to equal', '{"foo":123}'); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
173907
3667