@apideck/portman
Version:
Port OpenAPI Spec to Postman Collection, with contract & variation tests included
19 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.testResponseContentType = void 0;
var application_1 = require("../../application");
var testResponseContentType = function (contentType, pmOperation, _aOperation, config) {
var _a;
var split = (_a = config === null || config === void 0 ? void 0 : config.separatorSymbol) !== null && _a !== void 0 ? _a : '::';
var pmTest = [
"// Validate if response header has matching content-type\n",
"pm.test(\"[".concat(pmOperation.method.toUpperCase(), "]").concat(split).concat(pmOperation.path),
" - Content-Type is ".concat(contentType, "\", function () {\n"),
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"".concat(contentType, "\");\n"),
"});\n"
].join('');
(0, application_1.writeOperationTestScript)(pmOperation, pmTest);
return pmOperation;
};
exports.testResponseContentType = testResponseContentType;
//# sourceMappingURL=testResponseContentType.js.map