fets 0.0.13 → 0.0.14

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/cjs/Response.js CHANGED
@@ -15,6 +15,10 @@ function createLazySerializedResponse(jsonObj, init) {
15
15
  resolve = _resolve;
16
16
  });
17
17
  let _serializerSet = false;
18
+ const headers = new fetch_1.Headers({
19
+ ...init === null || init === void 0 ? void 0 : init.headers,
20
+ 'Content-Type': 'application/json',
21
+ });
18
22
  return {
19
23
  jsonObj,
20
24
  responsePromise: promise,
@@ -29,10 +33,7 @@ function createLazySerializedResponse(jsonObj, init) {
29
33
  resolve(new fetch_1.Response(serialized, {
30
34
  ...init,
31
35
  status: (init === null || init === void 0 ? void 0 : init.status) || 200,
32
- headers: {
33
- ...init === null || init === void 0 ? void 0 : init.headers,
34
- 'Content-Type': 'application/json',
35
- },
36
+ headers,
36
37
  }));
37
38
  },
38
39
  async json() {
@@ -41,6 +42,7 @@ function createLazySerializedResponse(jsonObj, init) {
41
42
  get status() {
42
43
  return ((init === null || init === void 0 ? void 0 : init.status) || 200);
43
44
  },
45
+ headers,
44
46
  };
45
47
  }
46
48
  exports.createLazySerializedResponse = createLazySerializedResponse;
package/esm/Response.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Response as OriginalResponse } from '@whatwg-node/fetch';
1
+ import { Headers, Response as OriginalResponse } from '@whatwg-node/fetch';
2
2
  export const LAZY_SERIALIZED_RESPONSE = Symbol('LAZY_SERIALIZED_RESPONSE');
3
3
  export const defaultSerializer = obj => JSON.stringify(obj);
4
4
  export function isLazySerializedResponse(response) {
@@ -10,6 +10,10 @@ export function createLazySerializedResponse(jsonObj, init) {
10
10
  resolve = _resolve;
11
11
  });
12
12
  let _serializerSet = false;
13
+ const headers = new Headers({
14
+ ...init === null || init === void 0 ? void 0 : init.headers,
15
+ 'Content-Type': 'application/json',
16
+ });
13
17
  return {
14
18
  jsonObj,
15
19
  responsePromise: promise,
@@ -24,10 +28,7 @@ export function createLazySerializedResponse(jsonObj, init) {
24
28
  resolve(new OriginalResponse(serialized, {
25
29
  ...init,
26
30
  status: (init === null || init === void 0 ? void 0 : init.status) || 200,
27
- headers: {
28
- ...init === null || init === void 0 ? void 0 : init.headers,
29
- 'Content-Type': 'application/json',
30
- },
31
+ headers,
31
32
  }));
32
33
  },
33
34
  async json() {
@@ -36,6 +37,7 @@ export function createLazySerializedResponse(jsonObj, init) {
36
37
  get status() {
37
38
  return ((init === null || init === void 0 ? void 0 : init.status) || 200);
38
39
  },
40
+ headers,
39
41
  };
40
42
  }
41
43
  // This allows us to hook into serialization of the response body
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fets",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -11,6 +11,7 @@ export interface LazySerializedResponse {
11
11
  jsonObj: any;
12
12
  json: () => Promise<any>;
13
13
  status: StatusCode;
14
+ headers: Headers;
14
15
  }
15
16
  export declare function isLazySerializedResponse(response: any): response is LazySerializedResponse;
16
17
  export declare function createLazySerializedResponse(jsonObj: any, init?: ResponseInit): LazySerializedResponse;
@@ -11,6 +11,7 @@ export interface LazySerializedResponse {
11
11
  jsonObj: any;
12
12
  json: () => Promise<any>;
13
13
  status: StatusCode;
14
+ headers: Headers;
14
15
  }
15
16
  export declare function isLazySerializedResponse(response: any): response is LazySerializedResponse;
16
17
  export declare function createLazySerializedResponse(jsonObj: any, init?: ResponseInit): LazySerializedResponse;