New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/xhr-upload

Package Overview
Dependencies
Maintainers
0
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/xhr-upload - npm Package Compare versions

Comparing version

to
4.3.3

7

CHANGELOG.md
# @uppy/xhr-upload
## 4.3.3
Released: 2025-02-25
Included in: Uppy v4.13.3
- @uppy/xhr-upload: fix when responseType is set to JSON (Merlijn Vos / #5651)
## 4.3.1

@@ -4,0 +11,0 @@

23

lib/index.js

@@ -18,3 +18,3 @@ function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; }

const packageJson = {
"version": "4.3.2"
"version": "4.3.3"
};

@@ -161,3 +161,3 @@ import locale from './locale.js';

try {
var _this$opts$getRespons, _this$opts2, _body2;
var _this$opts$getRespons, _this$opts2, _body3;
const res = await fetcher(url, {

@@ -195,11 +195,16 @@ ...options,

let body = await ((_this$opts$getRespons = (_this$opts2 = this.opts).getResponseData) == null ? void 0 : _this$opts$getRespons.call(_this$opts2, res));
try {
if (res.responseType === 'json') {
var _body;
(_body = body) != null ? _body : body = JSON.parse(res.responseText);
} catch (cause) {
throw new Error('@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.', {
cause
});
(_body = body) != null ? _body : body = res.response;
} else {
try {
var _body2;
(_body2 = body) != null ? _body2 : body = JSON.parse(res.responseText);
} catch (cause) {
throw new Error('@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.', {
cause
});
}
}
const uploadURL = typeof ((_body2 = body) == null ? void 0 : _body2.url) === 'string' ? body.url : undefined;
const uploadURL = typeof ((_body3 = body) == null ? void 0 : _body3.url) === 'string' ? body.url : undefined;
for (const {

@@ -206,0 +211,0 @@ id

{
"name": "@uppy/xhr-upload",
"description": "Plain and simple classic HTML multipart form uploads with Uppy, as well as uploads using the HTTP PUT method.",
"version": "4.3.2",
"version": "4.3.3",
"license": "MIT",

@@ -28,11 +28,11 @@ "main": "lib/index.js",

"@uppy/companion-client": "^4.4.1",
"@uppy/utils": "^6.1.1"
"@uppy/utils": "^6.1.2"
},
"devDependencies": {
"nock": "^13.1.0",
"vitest": "^1.2.1"
"vitest": "^1.6.1"
},
"peerDependencies": {
"@uppy/core": "^4.4.1"
"@uppy/core": "^4.4.2"
}
}

@@ -238,9 +238,14 @@ import { BasePlugin } from '@uppy/core'

let body = await this.opts.getResponseData?.(res)
try {
body ??= JSON.parse(res.responseText) as B
} catch (cause) {
throw new Error(
'@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.',
{ cause },
)
if (res.responseType === 'json') {
body ??= res.response
} else {
try {
body ??= JSON.parse(res.responseText) as B
} catch (cause) {
throw new Error(
'@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.',
{ cause },
)
}
}

@@ -247,0 +252,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet