Skip to content

Commit

Permalink
1.0.4: Ensure body is converted into string if it's an object.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Jan 12, 2016
1 parent 7562021 commit fd1a0e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions dist/mimemessage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* mimemessage v1.0.3
* mimemessage v1.0.4
* MIME messages for JavaScript (RFC 2045 & 2046)
* Copyright 2015 Iñaki Baz Castillo at eFace2Face, inc. (https://eface2face.com)
* Copyright 2015-2016 Iñaki Baz Castillo at eFace2Face, inc. (https://eface2face.com)
* License MIT
*/

Expand Down Expand Up @@ -146,8 +146,10 @@ Entity.prototype.toString = function (options) {
raw += '--' + boundary + '\r\n' + this._body[i].toString();
}
raw += '\r\n--' + boundary + '--';
} else if (this._body) {
raw += this._body.toString();
} else if (typeof this._body === 'string') {
raw += this._body;
} else if (typeof this._body === 'object') {
raw += JSON.stringify(this._body);
}

return raw;
Expand Down
6 changes: 4 additions & 2 deletions lib/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ Entity.prototype.toString = function (options) {
raw += '--' + boundary + '\r\n' + this._body[i].toString();
}
raw += '\r\n--' + boundary + '--';
} else if (this._body) {
raw += this._body.toString();
} else if (typeof this._body === 'string') {
raw += this._body;
} else if (typeof this._body === 'object') {
raw += JSON.stringify(this._body);
}

return raw;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mimemessage",
"version": "1.0.3",
"version": "1.0.4",
"description": "MIME messages for JavaScript (RFC 2045 & 2046)",
"author": "Iñaki Baz Castillo at eFace2Face, inc. (https://eface2face.com)",
"license": "MIT",
Expand Down

0 comments on commit fd1a0e2

Please sign in to comment.