feat(http): expose proxy configuration (#824)
* feat(http): add proxy config * chore: build iife api * chore: allow `too_many_arguments` * improvement * refactor: restructure code * improvement * formatpull/844/head
parent
c2115d8d21
commit
bfa87da848
@ -0,0 +1,6 @@
|
||||
---
|
||||
"http": minor
|
||||
"http-js": minor
|
||||
---
|
||||
|
||||
Add `proxy` field to `fetch` options to configure proxy.
|
@ -1 +1 @@
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";async function t(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}return"function"==typeof SuppressedError&&SuppressedError,e.fetch=async function(e,r){const n=r?.maxRedirections,i=r?.maxRedirections;r&&(delete r.maxRedirections,delete r.connectTimeout);const a=new Request(e,r),s=await a.arrayBuffer(),o=s.byteLength?Array.from(new Uint8Array(s)):null,u=await t("plugin:http|fetch",{method:a.method,url:a.url,headers:Array.from(a.headers.entries()),data:o,maxRedirections:n,connectTimeout:i});a.signal.addEventListener("abort",(()=>{t("plugin:http|fetch_cancel",{rid:u})}));const{status:_,statusText:d,url:c,headers:f}=await t("plugin:http|fetch_send",{rid:u}),h=await t("plugin:http|fetch_read_body",{rid:u}),p=new Response(new Uint8Array(h),{headers:f,status:_,statusText:d});return Object.defineProperty(p,"url",{value:c}),p},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})}
|
||||
if("__TAURI__"in window){var __TAURI_PLUGIN_HTTP__=function(e){"use strict";async function t(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}return"function"==typeof SuppressedError&&SuppressedError,e.fetch=async function(e,r){const n=r?.maxRedirections,i=r?.maxRedirections,a=r?.proxy;r&&(delete r.maxRedirections,delete r.connectTimeout,delete r.proxy);const o=new Request(e,r),s=await o.arrayBuffer(),d=s.byteLength?Array.from(new Uint8Array(s)):null,u=await t("plugin:http|fetch",{clientConfig:{method:o.method,url:o.url,headers:Array.from(o.headers.entries()),data:d,maxRedirections:n,connectTimeout:i,proxy:a}});o.signal.addEventListener("abort",(()=>{t("plugin:http|fetch_cancel",{rid:u})}));const{status:_,statusText:c,url:p,headers:f}=await t("plugin:http|fetch_send",{rid:u}),l=await t("plugin:http|fetch_read_body",{rid:u}),h=new Response(new Uint8Array(l),{headers:f,status:_,statusText:c});return Object.defineProperty(h,"url",{value:p}),h},e}({});Object.defineProperty(window.__TAURI__,"http",{value:__TAURI_PLUGIN_HTTP__})}
|
||||
|
Loading…
Reference in new issue