enhanced-fetch
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

enhanced-fetch

增强的fetch封装

Usage

$ npm install -S enhanced-fetch
import { createRequest, applyRequestMiddleware } from 'enhanced-fetch';
 
const middlewares = applyRequestMiddleware(
  // some middleware for api, such as debug, log, cache, tracker and so on.
);
 
const request = createRequest(middlewares);
 
request('http://xxx.com/api', {
  params: { aaa: 'aaa' },
  method: 'post',
  timeout: 5000,
}).then(response => {
  console.log('Got server response', response);
});

Readme

Keywords

none

Package Sidebar

Install

npm i enhanced-fetch

Weekly Downloads

1

Version

0.0.0

License

MIT

Unpacked Size

4.8 kB

Total Files

3

Last publish

Collaborators

  • tingge