add a generic check for json headers

This commit is contained in:
Dhroov Gupta
2019-07-12 12:22:16 +05:30
parent d344eed31c
commit c85d67319d

View File

@@ -11,8 +11,6 @@ const sdk = require('postman-collection'),
XML: 'xml' // used for request-body XMLs
},
URLENCODED = 'application/x-www-form-urlencoded',
APP_JSON = 'application/json',
APP_VND_JSON = 'application/vnd.api+json',
APP_JS = 'application/javascript',
APP_XML = 'application/xml',
TEXT_XML = 'text/xml',
@@ -607,7 +605,7 @@ module.exports = {
}
responseBody = this.convertToPmBodyData(contentObj[cTypeHeader], cTypeHeader, this.options.indentCharacter);
if (cTypeHeader === APP_JSON || cTypeHeader === APP_VND_JSON) {
if (cTypeHeader.startsWith('application') && cTypeHeader.endsWith('json')) {
responseBody = JSON.stringify(responseBody, null, this.options.indentCharacter);
}
else if (typeof responseBody !== 'string') {