UNPKG

test-openapi

Version:
27 lines (19 loc) 755 B
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.normalizeMethod=void 0;var _methods=_interopRequireDefault(require("methods")); var _error=require("../../../../errors/error.js");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} const normalizeMethod=function({ call, call:{method=DEFAULT_METHOD}}) { validateMethod({method}); return{...call,method}; };exports.normalizeMethod=normalizeMethod; const DEFAULT_METHOD="GET"; const validateMethod=function({method}){ if(_methods.default.includes(method.toLowerCase())){ return; } throw new _error.TestOpenApiError(`HTTP method '${method}' does not exist`,{ property:"task.call.method", value:method}); }; //# sourceMappingURL=method.js.map