@vida-global/core 2.0.3 → 2.0.4

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.
package/lib/http/error.js CHANGED
@@ -13,7 +13,7 @@ class HttpError extends Error {
13
13
  get message() { return `HTTP Error: ${this.status}`};
14
14
  get status() { return this.#response.status; }
15
15
  get statusText() { return this.#response.statusText; }
16
- get responseHeaders() { return structuredClone(this.#response.headers); }
16
+ get responseHeaders() { return Object.fromEntries(this.#response.headers.entries()) }
17
17
  get requestPayload() { return structuredClone(this.#requestPayload); }
18
18
  get url() { return this.#response.url; }
19
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vida-global/core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Core libraries for supporting Vida development",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -26,7 +26,7 @@ describe('HttpError', () => {
26
26
  });
27
27
 
28
28
  it ('stores copies of headers and request payload', () => {
29
- expect(error.responseHeaders).toEqual(response.headers);
29
+ expect(error.responseHeaders).toEqual(Object.fromEntries(response.headers.entries()));
30
30
  expect(error.responseHeaders).not.toBe(response.headers);
31
31
  expect(error.requestPayload).toEqual(requestPayload);
32
32
  expect(error.requestPayload).not.toBe(requestPayload);
@@ -2,10 +2,13 @@ const TestHelpers = require('@vida-global/test-helpers');
2
2
 
3
3
 
4
4
  function buildResponse(overrides = {}) {
5
+ const headers = {
6
+ requestId: TestHelpers.Faker.Text.randomString(),
7
+ traceId: TestHelpers.Faker.Text.randomString(),
8
+ }
5
9
  return {
6
10
  headers: {
7
- requestId: TestHelpers.Faker.Text.randomString(),
8
- traceId: TestHelpers.Faker.Text.randomString(),
11
+ entries: () => Object.entries(headers)
9
12
  },
10
13
  status: Math.floor(Math.random() * 500) + 100,
11
14
  statusText: TestHelpers.Faker.Text.randomString(),