mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Fixed validation issue where content type header was reported missing even if present
This commit is contained in:
@@ -1865,7 +1865,7 @@ module.exports = {
|
||||
return null;
|
||||
}
|
||||
_.forOwn(response.headers, (value, key) => {
|
||||
if (key !== 'Content-Type') {
|
||||
if (_.toLower(key) !== 'content-type') {
|
||||
if (value.$ref) {
|
||||
// the convert to PmHeader function handles the
|
||||
// schema-faking
|
||||
@@ -3726,7 +3726,8 @@ module.exports = {
|
||||
return false;
|
||||
}
|
||||
h.name = hName;
|
||||
return h.required;
|
||||
// exclude non-required and implicit header from further validation
|
||||
return h.required && !_.includes(IMPLICIT_HEADERS, _.toLower(hName));
|
||||
}), (header) => {
|
||||
if (!_.find(resHeaders, (param) => { return param.key === header.name; })) {
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@ paths:
|
||||
description: Null response
|
||||
default:
|
||||
description: unexpected error
|
||||
headers:
|
||||
content-type:
|
||||
description: content-type of response body
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
||||
@@ -415,6 +415,10 @@ describe('VALIDATE FUNCTION TESTS ', function () {
|
||||
the mismatch for header-1 should contain correct index as in request.
|
||||
*/
|
||||
expect(_.endsWith(resultObj.mismatches[0].transactionJsonPath, '[2].value')).to.eql(true);
|
||||
_.forEach(resultObj.responses, (response) => {
|
||||
expect(response.matched).to.be.true;
|
||||
expect(response.mismatches).to.have.lengthOf(0);
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user