New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 13.1.0-build-otaviojacobi-does-multipart-form-when-blob-is-present-11b0087dafe086f4d8ff565f8fffa6aa924a909b-1 to 13.1.0-build-otaviojacobi-does-multipart-form-when-blob-is-present-8868a8a60e940c9f0583ed0a00e4327c224f64b8-1

29

build/utils.js

@@ -321,8 +321,15 @@ "use strict";

const isFile = (value) => {
return (value != null &&
typeof value !== 'string' &&
return (value instanceof Blob &&
value.name != null &&
typeof value.name === 'string' &&
value instanceof Blob);
typeof value.name === 'string');
};
const getForm = () => {
if (!IS_BROWSER) {
const { FormData: NodeFormData } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('formdata-node');
return new NodeFormData();
}
return new FormData();
};
// This is the actual implementation that hides the internal `retriesRemaining` parameter

@@ -346,10 +353,3 @@ function requestAsync(fetch, options, retriesRemaining) {

}
const { FormData: NodeFormData } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('formdata-node');
const { FormDataEncoder } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('form-data-encoder');
const nodeForm = new NodeFormData();
const form = IS_BROWSER ? new FormData() : nodeForm;
const form = getForm();
let hasBlob = false;

@@ -368,3 +368,3 @@ for (const [k, v] of Object.entries((_a = options.body) !== null && _a !== void 0 ? _a : {})) {

// Browsers will handle set form data header and boundaries
// Given the correct header
// Given the correct body format
opts.headers.delete('Content-Type');

@@ -374,2 +374,5 @@ opts.body = form;

else {
const { FormDataEncoder } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('form-data-encoder');
const encoder = new FormDataEncoder(form);

@@ -376,0 +379,0 @@ opts.headers.set('Content-Type', encoder.headers['Content-Type']);

@@ -7,3 +7,3 @@ # Change Log

## 13.1.0 - 2023-10-18
## 13.1.0 - 2023-10-30

@@ -10,0 +10,0 @@ * Add multi part request support when File-like is present [Otávio Jacobi]

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

import type BalenaAuth from 'balena-auth';
import type { FormData as FormDataNodeType } from 'formdata-node';
import { TokenType } from 'balena-auth';

@@ -383,10 +384,19 @@ import type {

return (
value != null &&
typeof value !== 'string' &&
value instanceof Blob &&
value.name != null &&
typeof value.name === 'string' &&
value instanceof Blob
typeof value.name === 'string'
);
};
const getForm = (): FormDataNodeType | FormData => {
if (!IS_BROWSER) {
const { FormData: NodeFormData } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('formdata-node') as typeof import('formdata-node');
return new NodeFormData();
}
return new FormData();
};
// This is the actual implementation that hides the internal `retriesRemaining` parameter

@@ -414,11 +424,3 @@ async function requestAsync(

const { FormData: NodeFormData } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('formdata-node') as typeof import('formdata-node');
const { FormDataEncoder } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('form-data-encoder') as typeof import('form-data-encoder');
const nodeForm = new NodeFormData();
const form = IS_BROWSER ? new FormData() : nodeForm;
const form = getForm();
let hasBlob = false;

@@ -439,3 +441,3 @@ for (const [k, v] of Object.entries<string | WebResourceFile>(

// Browsers will handle set form data header and boundaries
// Given the correct header
// Given the correct body format
opts.headers.delete('Content-Type');

@@ -445,3 +447,7 @@

} else {
const encoder = new FormDataEncoder(form as typeof nodeForm);
const { FormDataEncoder } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('form-data-encoder') as typeof import('form-data-encoder');
const encoder = new FormDataEncoder(form as FormDataNodeType);
opts.headers.set('Content-Type', encoder.headers['Content-Type']);

@@ -448,0 +454,0 @@ const length = encoder.headers['Content-Length'];

{
"name": "balena-request",
"version": "13.1.0-build-otaviojacobi-does-multipart-form-when-blob-is-present-11b0087dafe086f4d8ff565f8fffa6aa924a909b-1",
"version": "13.1.0-build-otaviojacobi-does-multipart-form-when-blob-is-present-8868a8a60e940c9f0583ed0a00e4327c224f64b8-1",
"description": "Balena HTTP client",

@@ -87,4 +87,4 @@ "main": "build/request.js",

"versionist": {
"publishedAt": "2023-10-18T22:21:29.148Z"
"publishedAt": "2023-10-30T14:20:37.976Z"
}
}

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