1.3.9 • Published 4 years ago

@feizheng/next-fetch v1.3.9

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

next-fetch

Abstract for browser or node.

version license size download

installation

npm install -S @feizheng/next-fetch

options

optiontypedefaultdescription
fetchFunctionrequire('node-fetch')Defult fetch implement
dataTypeStringjsonjson/raw/urlencoded/multipart
responseTypeString/Nulljsonjson/text/blob/null

usage

import NxFetch from '@feizheng/next-fetch';

const http = NxFetch.getInstance({ responseType:'json' });

http.get('https://api.github.com/users/afeiship').then(res=>{
  console.log(res);
});

// {
//   login: 'afeiship',
//   id: 3038631,
//   node_id: 'MDQ6VXNlcjMwMzg2MzE=',
//   avatar_url: 'https://avatars2.githubusercontent.com/u/3038631?v=4',
    // .....
// }

resources

license

Code released under the MIT license.