Skip to content

Commit

Permalink
fix: modifies the data type detection logic for json-seq
Browse files Browse the repository at this point in the history
Fixes: #1681

Signed-off-by: Lance Ball <[email protected]>
  • Loading branch information
lance committed Feb 4, 2022
1 parent 84206c7 commit 4c4b046
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ Request.prototype._end = function () {
}

// by default only buffer text/*, json and messed up thing from hell
if ((undefined === buffer && isText(mime)) || isJSON(mime)) {
if ((undefined === buffer && isTextMimeType(mime)) || isJSON(mime)) {
buffer = true;
}

Expand Down Expand Up @@ -1335,7 +1335,7 @@ for (let method of methods) {
* @api public
*/

function isText(mime) {
function isTextMimeType(mime) {
const parts = mime.split('/');
let type = parts[0];
if (type) type = type.toLowerCase().trim();
Expand Down
1 change: 1 addition & 0 deletions src/node/parsers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
exports['application/x-www-form-urlencoded'] = require('./urlencoded');
exports['application/json'] = require('./json');
exports.text = require('./text');
exports['application/json-seq'] = exports.text;

const binary = require('./image');

Expand Down
1 change: 1 addition & 0 deletions test/node/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('exports', () => {
'application/x-www-form-urlencoded',
'application/json',
'text',
'application/json-seq',
'application/octet-stream',
'application/pdf',
'image'
Expand Down

0 comments on commit 4c4b046

Please sign in to comment.