@alibaba_inc/fetch_worker
v1.1.6
Published
fetch_worker
Downloads
60
Readme
fetchWorker
安装
npm install @alibaba_inc/fetch_workerimport fetch_worker from "@alibaba_inc/fetch_worker";
fetch_worker(
{
url: "https://example.org/get?a=1&b=2",
sendParams: {
method: "GET",
},
},
(rs) => {
console.log(rs);
}
);
fetch_worker(
{
url: "https://example.org/post",
sendParams: {
method: "POST",
body: JSON.stringify({ a: 1, b: 2 }),
},
},
(rs) => {
console.log(rs);
}
);
fetch_worker(
{
url: "https://example.org/post",
sendParams: {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
method: "POST",
body: "A=1&B=2",
},
},
(rs) => {
console.log(rs);
}
);