fatcher

A out-of-box http request library with fetch for modern browsers.

Usage no npm install needed!

<script type="module">
  import fatcher from 'https://cdn.skypack.dev/fatcher';
</script>

README

Fatcher

A out-of-box πŸ“¦ http request library with fetch for modern browsers.

codecov npm package node compatibility build status


Languages

English | δΈ­ζ–‡

Browsers

Chrome Firefox Edge Safari IE
βœ… latest βœ… latest βœ… latest βœ… latest ❌ Not Support

Features

  • ✨ Built-in common request encapsulation and default configuration, no additional configuration required.
  • ✨ Flexible middleware system that processes data in different scenarios through different combinations of middleware.
  • ✨ Data emulation of each request is supported to obtain simulated data returned by the interface at development.
  • ✨ Written entirely in TypeScript, the complete type system is much easier to use.
  • ✨ Data is returned as a stream and can be read and operated at the same time to speed up interface processing.
  • ✨ Request payload and response data are automatically converted without manual conversion.

Install

NPM

>$ npm install fatcher

CDN

<script src="https://cdn.jsdelivr.net/npm/fatcher/dist/fatcher.min.js"></script>

usage

import { fatcher } from 'fatcher';

fatcher(
    '/api/my/request/url', //request url
    {
        //options
        method: 'get',
        payload: {
            a: 1,
            b: 2,
            c: 3,
        },
    }
)
    .then(res => {
        // response here
    })
    .catch(err => {
        // request error here.
    });

More

More information in document

License

MIT