Skip to content

Commit

Permalink
fix(http): remove cmd property from http|fetch invoke, closes #587 (
Browse files Browse the repository at this point in the history
#588)

* Remove `cmd` property from `http|fetch` invoke

* Build generated JS file

* Create http-remove-cmd-property.md

* Fix incompatible declaration for reading body

Co-authored-by: Louis Bailleau <Bricklou@users.noreply.github.com>

* Build generated JS file

Co-authored-by: Louis Bailleau <Bricklou@users.noreply.github.com>

---------

Co-authored-by: Louis Bailleau <Bricklou@users.noreply.github.com>
  • Loading branch information
i-c-b and Bricklou authored Sep 4, 2023
1 parent 319de69 commit 2cb0fa7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/http-remove-cmd-property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"http": patch
---

Remove `cmd` property which breaks invoke call.
3 changes: 1 addition & 2 deletions plugins/http/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export async function fetch(
const reqData = buffer.byteLength ? Array.from(new Uint8Array(buffer)) : null;

const rid = await window.__TAURI_INVOKE__<number>("plugin:http|fetch", {
cmd: "fetch",
method: req.method,
url: req.url,
headers: Array.from(req.headers.entries()),
Expand Down Expand Up @@ -111,7 +110,7 @@ export async function fetch(
},
);

const res = new Response(Uint8Array.from(body), {
const res = new Response(new Uint8Array(body), {
headers,
status,
statusText,
Expand Down
2 changes: 1 addition & 1 deletion plugins/http/src/api-iife.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2cb0fa7

Please sign in to comment.