@scalar/api-client
Version:
the open source API testing client
19 lines (18 loc) • 531 B
JavaScript
import { findRequestByPathMethod as h } from "./find-request.js";
const u = (t, d) => {
const { requestUid: a, method: e, path: o } = d ?? {};
if (a)
return a;
if (!o || !e)
return Object.keys(t)[0];
const s = Object.values(t), n = s.find(
(c) => c.path.toLowerCase() === o.toLowerCase() && c.method.toLowerCase() === e.toLowerCase()
);
if (n)
return n.uid;
const { request: r } = h(o, e, s);
return (r == null ? void 0 : r.uid) || Object.keys(t)[0];
};
export {
u as getRequestUidByPathMethod
};