@webqit/webflo 0.9.0-0 → 0.9.0

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/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.9.0-0",
15
+ "version": "0.9.0",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -8,29 +8,26 @@ import fetch, { Request, Response, Headers } from 'node-fetch';
8
8
  import { FormDataEncoder } from 'form-data-encoder';
9
9
  import { Readable } from "stream";
10
10
 
11
- /**
12
- * Patch MessageStream with formData()
13
- */
14
- const _streamFormDataPatch = MessageStream => class extends MessageStream {
15
- // formData() polyfill
16
- async formData() { return null; }
17
- };
18
-
19
11
  /**
20
12
  * The NavigationEvent class
21
13
  */
22
- const Request2 = _streamFormDataPatch(Request);
23
- const Response2 = _streamFormDataPatch(Response);
14
+ if (!Request.prototype.formData) {
15
+ Request.prototype.formData = async function() { return null }
16
+ }
17
+ if (!Response.prototype.formData) {
18
+ Response.prototype.formData = async function() { return null }
19
+ }
24
20
  FormData.encode = formData => {
25
21
  const encoder = new FormDataEncoder(formData);
26
22
  return [ Readable.from(encoder.encode()), encoder.headers ];
27
23
  };
24
+
28
25
  export {
29
26
  URL,
30
27
  fetch,
31
28
  Headers,
32
- Request2 as Request,
33
- Response2 as Response,
29
+ Request,
30
+ Response,
34
31
  FormData,
35
32
  Readable as ReadableStream,
36
33
  File,
@@ -13,7 +13,7 @@ const xResponse = (whatwagResponse, Headers, FormData) => class extends xHttpMes
13
13
  constructor(body = null, init = {}) {
14
14
  let bodyAttrs = {}, isResponseInput;
15
15
  if (arguments.length) {
16
- if ((body instanceof whatwagResponse)) {
16
+ if (body instanceof whatwagResponse) {
17
17
  isResponseInput = body;
18
18
  // Inherit init
19
19
  init = { status: body.status, statusText: body.statusText, headers: body.headers, ...init };
@@ -29,6 +29,7 @@ const xResponse = (whatwagResponse, Headers, FormData) => class extends xHttpMes
29
29
  super(body, init, bodyAttrs);
30
30
  if (isResponseInput) {
31
31
  // Through the backdoor
32
+ this.attrs.url = isResponseInput.url;
32
33
  this.attrs.ok = isResponseInput.ok;
33
34
  this.attrs.status = isResponseInput.status; // In case it was earlier deleted
34
35
  this.attrs.type = isResponseInput.type;