@taybart/corvid 0.1.29 → 0.1.30

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/dist/index.js CHANGED
@@ -539,16 +539,18 @@ class request {
539
539
  url = `${url}?${reqParams.toString()}`;
540
540
  }
541
541
  override.headers = override.headers || {};
542
+ const headers = {
543
+ ...this.opts.headers,
544
+ ...override.headers
545
+ };
546
+ if (body instanceof FormData) delete headers['Content-Type'];
542
547
  this.log.debug(`${this.opts.method} ${url}`);
543
548
  return {
544
549
  url,
545
550
  options: {
546
551
  method: override.method || this.opts.method,
547
552
  credentials: this.opts.credentials,
548
- headers: {
549
- ...this.opts.headers,
550
- ...override.headers
551
- },
553
+ headers,
552
554
  body: body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer ? body : JSON.stringify(body)
553
555
  }
554
556
  };
package/dist/network.d.ts CHANGED
@@ -55,15 +55,7 @@ export declare class request {
55
55
  options: {
56
56
  method: string | undefined;
57
57
  credentials: RequestCredentials | undefined;
58
- headers: {
59
- constructor: Function;
60
- toString(): string;
61
- toLocaleString(): string;
62
- valueOf(): Object;
63
- hasOwnProperty(v: PropertyKey): boolean;
64
- isPrototypeOf(v: Object): boolean;
65
- propertyIsEnumerable(v: PropertyKey): boolean;
66
- };
58
+ headers: Record<string, string>;
67
59
  body: string | ArrayBuffer | FormData | Blob;
68
60
  };
69
61
  };
package/dist/network.js CHANGED
@@ -114,16 +114,18 @@ class request {
114
114
  url = `${url}?${reqParams.toString()}`;
115
115
  }
116
116
  override.headers = override.headers || {};
117
+ const headers = {
118
+ ...this.opts.headers,
119
+ ...override.headers
120
+ };
121
+ if (body instanceof FormData) delete headers['Content-Type'];
117
122
  this.log.debug(`${this.opts.method} ${url}`);
118
123
  return {
119
124
  url,
120
125
  options: {
121
126
  method: override.method || this.opts.method,
122
127
  credentials: this.opts.credentials,
123
- headers: {
124
- ...this.opts.headers,
125
- ...override.headers
126
- },
128
+ headers,
127
129
  body: body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer ? body : JSON.stringify(body)
128
130
  }
129
131
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taybart/corvid",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {