mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Code Quality
This commit is contained in:
parent
fd6fb456b4
commit
aa7bbbd4e9
3 changed files with 66 additions and 42 deletions
|
|
@ -36,7 +36,15 @@ export function pipInterceptorForUrl(url) {
|
|||
* @returns {import("../interceptorBuilder.js").Interceptor | undefined}
|
||||
*/
|
||||
function buildPipInterceptor(registry) {
|
||||
return interceptRequests(async (reqContext) => {
|
||||
return interceptRequests(createPipRequestHandler(registry));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} registry
|
||||
* @returns {(reqContext: import("../interceptorBuilder.js").RequestInterceptionContext) => Promise<void>}
|
||||
*/
|
||||
function createPipRequestHandler(registry) {
|
||||
return async (reqContext) => {
|
||||
const { packageName, version } = parsePipPackageFromUrl(
|
||||
reqContext.targetUrl,
|
||||
registry
|
||||
|
|
@ -76,5 +84,5 @@ function buildPipInterceptor(registry) {
|
|||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue