mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
add a generic check for json headers
This commit is contained in:
@@ -11,8 +11,6 @@ const sdk = require('postman-collection'),
|
|||||||
XML: 'xml' // used for request-body XMLs
|
XML: 'xml' // used for request-body XMLs
|
||||||
},
|
},
|
||||||
URLENCODED = 'application/x-www-form-urlencoded',
|
URLENCODED = 'application/x-www-form-urlencoded',
|
||||||
APP_JSON = 'application/json',
|
|
||||||
APP_VND_JSON = 'application/vnd.api+json',
|
|
||||||
APP_JS = 'application/javascript',
|
APP_JS = 'application/javascript',
|
||||||
APP_XML = 'application/xml',
|
APP_XML = 'application/xml',
|
||||||
TEXT_XML = 'text/xml',
|
TEXT_XML = 'text/xml',
|
||||||
@@ -607,7 +605,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
responseBody = this.convertToPmBodyData(contentObj[cTypeHeader], cTypeHeader, this.options.indentCharacter);
|
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);
|
responseBody = JSON.stringify(responseBody, null, this.options.indentCharacter);
|
||||||
}
|
}
|
||||||
else if (typeof responseBody !== 'string') {
|
else if (typeof responseBody !== 'string') {
|
||||||
|
|||||||
Reference in New Issue
Block a user