Socket
Socket
Sign inDemoInstall

@snyk/docker-registry-v2-client

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snyk/docker-registry-v2-client - npm Package Compare versions

Comparing version 2.2.4 to 2.3.0

2

dist/needle.d.ts

@@ -13,4 +13,4 @@ import { NeedleOptions, NeedleResponse } from "needle";

*/
export declare function needleWrapper(options: RequestOptions): Promise<NeedleResponse>;
export declare function needleWrapper(options: RequestOptions, maxRetries?: number): Promise<NeedleResponse>;
export declare function parseResponseBody(response: NeedleResponse): any;
export {};

@@ -22,3 +22,3 @@ "use strict";

*/
async function needleWrapper(options) {
async function needleWrapper(options, maxRetries) {
var _a, _b;

@@ -37,3 +37,17 @@ let uri = options.uri;

}
const response = await needle("get", uri, options);
let response;
let lastError;
let retries = maxRetries !== null && maxRetries !== void 0 ? maxRetries : 0;
while (!response && retries >= 0) {
retries--;
try {
response = await needle("get", uri, options);
}
catch (err) {
lastError = err;
}
}
if (!response) {
throw lastError;
}
// throw an error in case status code is not 2xx

@@ -40,0 +54,0 @@ if (response && response.statusCode >= 300) {

@@ -8,6 +8,7 @@ "use strict";

const BEARER_REALM = "Bearer realm";
const MAX_RETRIES = 1;
async function registryV2Call(registryBase, endpoint, accept, username, password, reqOptions = {}) {
const reqConfig = buildUnauthenticatedV2RequestConfig(registryBase, endpoint, accept, reqOptions);
try {
return await needle_1.needleWrapper(reqConfig);
return await needle_1.needleWrapper(reqConfig, MAX_RETRIES);
}

@@ -24,3 +25,3 @@ catch (err) {

try {
return await needle_1.needleWrapper(authConfig);
return await needle_1.needleWrapper(authConfig, MAX_RETRIES);
}

@@ -132,3 +133,3 @@ catch (err) {

config.uri = redirectUrl;
return await needle_1.needleWrapper(config);
return await needle_1.needleWrapper(config, MAX_RETRIES);
}

@@ -135,0 +136,0 @@ /*

@@ -45,3 +45,3 @@ {

},
"version": "2.2.4"
"version": "2.3.0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc