easy-fetcher
TypeScript icon, indicating that this package has built-in type declarations

1.5.4 • Public • Published

#easy-fetcher ##项目介绍 基于promise和fetch封装的网络请求库 ##使用范例

        async request() {
               const fetcher = new Fetcher("http://www.***.com", {headers:{"Content-Type": "application/json"},credentials: "include"}, DataType.JSON, 10000);
               try {
                   // fetcher.delete|post|get|patch...
                   const result = await fetcher.post({
                       path: "/ass/ddd",
                       pathId: 123,
                       query: {limit: [1, 20]},
                       body: {name: "abc", age: 12},
                       headers: {"token": "abcd", "Content-Type": "application/***"}
                   });
                   console.log(result);
               } catch (e) {
                   console.log(e);
               }
           }

Readme

Keywords

Package Sidebar

Install

npm i easy-fetcher

Weekly Downloads

0

Version

1.5.4

License

ISC

Unpacked Size

15.3 kB

Total Files

5

Last publish

Collaborators

  • liuyanghong