"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.callMiddleware=callMiddleware;const urllib_1=require("urllib"),faas_server_utils_1=require("@alipay/faas-server-utils"),debug=(0,faas_server_utils_1.debuglog)("faas-server-sdk:httpRequest");async function callMiddleware(e,s){await s(),debug("%s %o with headers: %o, content: %o",e.req.requestOptions.method,e.req.url.href,e.req.requestOptions.headers,e.req.requestOptions.content),e.res=await(0,urllib_1.request)(e.req.url,e.req.requestOptions),e.result={status:e.res.status,requestID:e.requestId,headers:e.res.headers,data:e.res.data},debug("%s %o got response status: %o, headers: %o, data: %o",e.req.requestOptions.method,e.req.url.href,e.res.status,e.res.headers,e.res.data)}