import { httpRequest as s } from "../utils/request.mjs";
import { DataSourceUtils as c } from "../utils/utils.mjs";
const u = (a) => new Promise(function(n, i) {
  const o = c.getEnvironments(), h = c.getVariableData();
  let { isHeaders: f, isBody: d, headers: e, contentType: m, url: r, postParam: l } = a;
  const p = c.replaceEnvVariables(r, o);
  d && (l = c.replaceObjectVariables(d, h)), f && (e = c.replaceObjectVariables(f, h)), a.type === "GET" && s.get(p + r, { headers: e }).then((t) => {
    n(t.data);
  }).catch((t) => {
    i(t);
  }), a.type === "POST" && s.post(p + r, l, { headers: e }, m).then((t) => {
    n(t.data);
  }).catch((t) => {
    i(t);
  }), a.type === "PUT" && s.put(p + r, l, { headers: e }, m).then((t) => {
    n(t.data);
  }).catch((t) => {
    i(t);
  }), a.type === "DELETE" && s.delete(p + r, { headers: e }).then((t) => {
    n(t.data);
  }).catch((t) => {
    i(t);
  });
});
export {
  u as parseAPIPortHjly
};
