Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

balena-request

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

balena-request - npm Package Compare versions

Comparing version 11.0.0-11-x-66f73073baaa86926b5373d1140017553061d195 to 11.0.0-11-x-696cdba6d93b6c39e9fde204642bfdf67f440b5d

5

build/progress.js

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

* @param {Function} [onState] - on state callback (state)
* @returns {ReadableStream} progress stream
* @returns {NodeJS.ReadableStream} progress stream
*

@@ -77,3 +77,3 @@ * @example

*
* @returns {(options) => Promise<ReadableStream>} request stream
* @returns {(options) => Promise<NodeJS.ReadableStream>} request stream
*

@@ -87,3 +87,2 @@ * @example

function estimate(requestAsync, isBrowser) {
// @ts-expect-error
return function (options) {

@@ -90,0 +89,0 @@ return __awaiter(this, void 0, void 0, function* () {

21

build/request.js

@@ -31,3 +31,2 @@ "use strict";

const urlLib = require("url");
const rindle = require("rindle");
const fetchReadableStream = require("fetch-readablestream");

@@ -226,3 +225,3 @@ const errors = require("balena-errors");

*
* @returns {Promise<ReadableStream>} response
* @returns {Promise<NodeJS.ReadableStream>} response
*

@@ -245,3 +244,3 @@ * @example

.then((opts) => __awaiter(this, void 0, void 0, function* () {
const download = yield (progress.estimate(requestStream, isBrowser)(opts));
const download = yield progress.estimate(requestStream, isBrowser)(opts);
// @ts-expect-error

@@ -254,6 +253,14 @@ if (!utils.isErrorCode(download.response.statusCode)) {

}
// If status code is an error code, interpret
// the body of the request as an error.
const data = yield rindle.extract(download);
const responseError = data || 'The request was unsuccessful';
// If status code is an error code, interpret the body of the request as an error.
const chunks = [];
download.on('data', function (chunk) {
chunks.push(chunk);
});
yield new Promise((resolve, reject) => {
download.on('error', reject);
download.on('close', resolve);
download.on('end', resolve);
download.on('done', resolve);
});
const responseError = chunks.join() || 'The request was unsuccessful';
// @ts-expect-error

@@ -260,0 +267,0 @@ debugRequest(options, download.response);

@@ -10,2 +10,3 @@ # Change Log

* Remove rindle dependency [Pagan Gazzard]
* Update balena-auth to 4.x [Pagan Gazzard]

@@ -12,0 +13,0 @@ * Drop support for nodejs < 10 [Pagan Gazzard]

@@ -35,3 +35,3 @@ /*

* @param {Function} [onState] - on state callback (state)
* @returns {ReadableStream} progress stream
* @returns {NodeJS.ReadableStream} progress stream
*

@@ -73,3 +73,3 @@ * @example

*
* @returns {(options) => Promise<ReadableStream>} request stream
* @returns {(options) => Promise<NodeJS.ReadableStream>} request stream
*

@@ -83,3 +83,2 @@ * @example

export function estimate(requestAsync, isBrowser) {
// @ts-expect-error
return async function (options) {

@@ -86,0 +85,0 @@ if (requestAsync == null) {

@@ -22,3 +22,2 @@ /*

import * as urlLib from 'url';
import * as rindle from 'rindle';
import * as fetchReadableStream from 'fetch-readablestream';

@@ -193,7 +192,7 @@ import * as errors from 'balena-errors';

.then(interceptRequestOptions, interceptRequestError)
.then(async (opts) =>{
let response
.then(async (opts) => {
let response;
try {
response = await requestAsync(opts)
}catch (err) {
response = await requestAsync(opts);
} catch (err) {
err.requestOptions = opts;

@@ -203,3 +202,3 @@ throw err;

const body = await utils.getBody(response, options.responseFormat)
const body = await utils.getBody(response, options.responseFormat);
response = { ...response, body };

@@ -247,3 +246,3 @@

*
* @returns {Promise<ReadableStream>} response
* @returns {Promise<NodeJS.ReadableStream>} response
*

@@ -267,3 +266,6 @@ * @example

.then(async (opts) => {
const download = await (progress.estimate(requestStream, isBrowser)(opts))
const download = await progress.estimate(
requestStream,
isBrowser,
)(opts);
// @ts-expect-error

@@ -278,6 +280,14 @@ if (!utils.isErrorCode(download.response.statusCode)) {

// If status code is an error code, interpret
// the body of the request as an error.
const data = await rindle.extract(download);
const responseError = data || 'The request was unsuccessful';
// If status code is an error code, interpret the body of the request as an error.
const chunks = [];
download.on('data', function (chunk) {
chunks.push(chunk);
});
await new Promise((resolve, reject) => {
download.on('error', reject);
download.on('close', resolve);
download.on('end', resolve);
download.on('done', resolve);
});
const responseError = chunks.join() || 'The request was unsuccessful';
// @ts-expect-error

@@ -381,3 +391,3 @@ debugRequest(options, download.response);

}
throw err
throw err;
}

@@ -384,0 +394,0 @@ const refreshedKey = response.body;

{
"name": "balena-request",
"version": "11.0.0-11-x-66f73073baaa86926b5373d1140017553061d195",
"version": "11.0.0-11-x-696cdba6d93b6c39e9fde204642bfdf67f440b5d",
"description": "Balena HTTP client",

@@ -49,2 +49,3 @@ "main": "build/request.js",

"resin-config-karma": "^1.0.4",
"rindle": "^1.3.6",
"temp": "^0.8.4",

@@ -61,4 +62,3 @@ "timekeeper": "^1.0.0",

"progress-stream": "^2.0.0",
"qs": "^6.9.4",
"rindle": "^1.3.6"
"qs": "^6.9.4"
},

@@ -65,0 +65,0 @@ "peerDependencies": {

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