@mittwald/api-client-commons 4.309.0 → 4.310.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.
@@ -117,8 +117,8 @@ test("test request will be resolved even when status check fails", async () => {
117
117
  // check resolves
118
118
  await expect(response).resolves.toHaveProperty("data.fail", 1);
119
119
  // check interceptor call
120
- expect(success).toBeCalledTimes(0);
121
- expect(fail).toBeCalledWith("500");
120
+ expect(success).toBeCalledWith("500");
121
+ expect(fail).not.toHaveBeenCalled();
122
122
  });
123
123
  test("test request will rejects on network error", async () => {
124
124
  const success = jest.fn();
@@ -16,6 +16,13 @@ export class Request {
16
16
  }
17
17
  catch (e) {
18
18
  const error = AxiosError.from(e);
19
+ /**
20
+ * Since Axios 1.13.3 the error object does not contain the response
21
+ * anymore, even if the error is an HTTP error. To maintain the previous
22
+ * behavior of returning the response even for HTTP errors, the
23
+ * validateStatus option is set to always return true, which means that
24
+ * HTTP errors will not throw an error.
25
+ */
19
26
  if (error.isAxiosError && error.response) {
20
27
  return error.response;
21
28
  }
@@ -47,6 +54,12 @@ export class Request {
47
54
  // Must be a plain object or an URLSearchParams object
48
55
  params,
49
56
  data,
57
+ /**
58
+ * The API client is designed to return all responses, regardless of the
59
+ * status code. This allows the caller to handle error responses as
60
+ * needed.
61
+ */
62
+ validateStatus: () => true,
50
63
  };
51
64
  }
52
65
  makeAxiosHeaders(headers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/api-client-commons",
3
- "version": "4.309.0",
3
+ "version": "4.310.1",
4
4
  "author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
5
5
  "type": "module",
6
6
  "description": "Common types and utilities for mittwald API clients",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@types/parse-path": "^7.0.3",
44
- "axios": "^1.12.2",
44
+ "axios": "^1.13.5",
45
45
  "parse-path": "^7.1.0",
46
46
  "path-to-regexp": "^8.3.0",
47
47
  "type-fest": "^4.30.0"
@@ -52,7 +52,6 @@
52
52
  "@types/jest": "^29.5.14",
53
53
  "@typescript-eslint/eslint-plugin": "^7.18.0",
54
54
  "@typescript-eslint/parser": "^7.18.0",
55
- "axios": "^1.12.2",
56
55
  "eslint": "^8.57.1",
57
56
  "eslint-config-prettier": "^9.1.2",
58
57
  "eslint-plugin-json": "^3.1.0",
@@ -80,5 +79,5 @@
80
79
  "optional": true
81
80
  }
82
81
  },
83
- "gitHead": "123d908f2ae0df8b1e42c60d9f3e9d3a22f949b4"
82
+ "gitHead": "66244dedc30ac59acc2923b69613eb42b1d28b72"
84
83
  }