@tauri-apps/plugin-http 2.0.0-alpha.6 → 2.0.0-beta.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/README.md CHANGED
@@ -18,7 +18,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
18
18
 
19
19
  ```toml
20
20
  [dependencies]
21
- tauri-plugin-http = "2.0.0-alpha"
21
+ tauri-plugin-http = "2.0.0-beta"
22
22
  # alternatively with Git:
23
23
  tauri-plugin-http = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
24
24
  ```
package/dist-js/index.cjs CHANGED
@@ -42,7 +42,7 @@ var core = require('@tauri-apps/api/core');
42
42
  */
43
43
  async function fetch(input, init) {
44
44
  const maxRedirections = init?.maxRedirections;
45
- const connectTimeout = init?.maxRedirections;
45
+ const connectTimeout = init?.connectTimeout;
46
46
  const proxy = init?.proxy;
47
47
  // Remove these fields before creating the request
48
48
  if (init) {
@@ -50,6 +50,7 @@ async function fetch(input, init) {
50
50
  delete init.connectTimeout;
51
51
  delete init.proxy;
52
52
  }
53
+ const signal = init?.signal;
53
54
  const req = new Request(input, init);
54
55
  const buffer = await req.arrayBuffer();
55
56
  const reqData = buffer.byteLength ? Array.from(new Uint8Array(buffer)) : null;
@@ -64,16 +65,16 @@ async function fetch(input, init) {
64
65
  proxy,
65
66
  },
66
67
  });
67
- req.signal.addEventListener("abort", () => {
68
+ signal?.addEventListener("abort", () => {
68
69
  core.invoke("plugin:http|fetch_cancel", {
69
70
  rid,
70
71
  });
71
72
  });
72
- const { status, statusText, url, headers } = await core.invoke("plugin:http|fetch_send", {
73
+ const { status, statusText, url, headers, rid: responseRid, } = await core.invoke("plugin:http|fetch_send", {
73
74
  rid,
74
75
  });
75
76
  const body = await core.invoke("plugin:http|fetch_read_body", {
76
- rid,
77
+ rid: responseRid,
77
78
  });
78
79
  const res = new Response(new Uint8Array(body), {
79
80
  headers,
package/dist-js/index.js CHANGED
@@ -40,7 +40,7 @@ import { invoke } from '@tauri-apps/api/core';
40
40
  */
41
41
  async function fetch(input, init) {
42
42
  const maxRedirections = init?.maxRedirections;
43
- const connectTimeout = init?.maxRedirections;
43
+ const connectTimeout = init?.connectTimeout;
44
44
  const proxy = init?.proxy;
45
45
  // Remove these fields before creating the request
46
46
  if (init) {
@@ -48,6 +48,7 @@ async function fetch(input, init) {
48
48
  delete init.connectTimeout;
49
49
  delete init.proxy;
50
50
  }
51
+ const signal = init?.signal;
51
52
  const req = new Request(input, init);
52
53
  const buffer = await req.arrayBuffer();
53
54
  const reqData = buffer.byteLength ? Array.from(new Uint8Array(buffer)) : null;
@@ -62,16 +63,16 @@ async function fetch(input, init) {
62
63
  proxy,
63
64
  },
64
65
  });
65
- req.signal.addEventListener("abort", () => {
66
+ signal?.addEventListener("abort", () => {
66
67
  invoke("plugin:http|fetch_cancel", {
67
68
  rid,
68
69
  });
69
70
  });
70
- const { status, statusText, url, headers } = await invoke("plugin:http|fetch_send", {
71
+ const { status, statusText, url, headers, rid: responseRid, } = await invoke("plugin:http|fetch_send", {
71
72
  rid,
72
73
  });
73
74
  const body = await invoke("plugin:http|fetch_read_body", {
74
- rid,
75
+ rid: responseRid,
75
76
  });
76
77
  const res = new Response(new Uint8Array(body), {
77
78
  headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-http",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-beta.0",
4
4
  "license": "MIT or APACHE-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"
@@ -20,7 +20,7 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "dependencies": {
23
- "@tauri-apps/api": "2.0.0-alpha.13"
23
+ "@tauri-apps/api": "2.0.0-beta.0"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "rollup -c"