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