balena-request 14.2.0 → 14.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,17 @@
1
+ - commits:
2
+ - subject: Avoid unnecessary array creations while running the response interceptors
3
+ hash: 2150d6669ae50eed667b32bc5d930d8568d14648
4
+ body: ""
5
+ footer:
6
+ Change-type: patch
7
+ change-type: patch
8
+ See: https://balena.fibery.io/Work/Project/2327
9
+ see: https://balena.fibery.io/Work/Project/2327
10
+ author: Thodoris Greasidis
11
+ nested: []
12
+ version: 14.2.1
13
+ title: ""
14
+ date: 2026-04-24T09:09:47.283Z
1
15
  - commits:
2
16
  - subject: Export error types for users to be able to use `instanceof` with
3
17
  hash: c4e43ac0a7ac563a213f7685d4c1f7e4c5dbc1a9
@@ -9,7 +23,7 @@
9
23
  nested: []
10
24
  version: 14.2.0
11
25
  title: ""
12
- date: 2026-03-24T17:58:52.530Z
26
+ date: 2026-03-24T18:12:09.034Z
13
27
  - commits:
14
28
  - subject: Use a backwards compatible alternative to URL.canParse
15
29
  hash: af8fb6b626f2485d1db6e0ccbd6f47487a3d84c2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
4
4
  automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
5
5
  This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## 14.2.1 - 2026-04-24
8
+
9
+ * Avoid unnecessary array creations while running the response interceptors [Thodoris Greasidis]
10
+
7
11
  ## 14.2.0 - 2026-03-24
8
12
 
9
13
  * Export error types for users to be able to use `instanceof` with [Pagan Gazzard]
package/build/request.js CHANGED
@@ -121,9 +121,9 @@ function getRequest({ auth, debug = false, retries = 0, interceptors: $intercept
121
121
  };
122
122
  const interceptResponseOrError = async function (initialPromise) {
123
123
  let promise = initialPromise;
124
- for (const { response, responseError } of exports.interceptors
125
- .slice()
126
- .reverse()) {
124
+ // We execute response interceptors in reverse order.
125
+ for (let i = exports.interceptors.length - 1; i >= 0; i--) {
126
+ const { response, responseError } = exports.interceptors[i];
127
127
  if (response != null || responseError != null) {
128
128
  promise = promise.then(response, responseError);
129
129
  }
package/lib/request.ts CHANGED
@@ -247,9 +247,9 @@ export function getRequest({
247
247
  initialPromise: Promise<any>,
248
248
  ) {
249
249
  let promise = initialPromise;
250
- for (const { response, responseError } of exports.interceptors
251
- .slice()
252
- .reverse()) {
250
+ // We execute response interceptors in reverse order.
251
+ for (let i = exports.interceptors.length - 1; i >= 0; i--) {
252
+ const { response, responseError } = exports.interceptors[i];
253
253
  if (response != null || responseError != null) {
254
254
  promise = promise.then(response, responseError);
255
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "balena-request",
3
- "version": "14.2.0",
3
+ "version": "14.2.1",
4
4
  "description": "Balena HTTP client",
5
5
  "type": "commonjs",
6
6
  "main": "build/request.js",
@@ -85,6 +85,6 @@
85
85
  "balena-auth": "^6.0.1"
86
86
  },
87
87
  "versionist": {
88
- "publishedAt": "2026-03-24T17:58:52.637Z"
88
+ "publishedAt": "2026-04-24T09:09:47.404Z"
89
89
  }
90
90
  }