0.2.0 • Published 2 years ago

@jobscale/fetch v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@jobscale/fetch

Same as 'axios'

See: https://www.npmjs.com/package/axios

Installation

npm i @jobscale/fetch

Jest test

docker run --rm -p 127.0.0.1:3128:3128 -d ghcr.io/jobscale/squid
npm test

Examples

const fetch = require('@jobscale/fetch');

const logger = console;
const main = async () => {
  logger.info([
    { ip: await fetch('https://inet-ip.info/ip').then(res => res.data) },
    { ip: await fetch('https://inet-ip.info/ip', { 'user-agent': 'fetch' }).then(res => res.data) },
    { ip: await fetch('https://inet-ip.info/ip', { method: 'post', 'user-agent': 'fetch' }).then(res => res.data) },
    { ip: await fetch({ url: 'https://inet-ip.info/ip', method: 'post', 'user-agent': 'fetch' }).then(res => res.data) },
    await fetch({ url: 'https://inet-ip.info/json', method: 'post', 'user-agent': 'fetch' }).then(res => res.data),
  ]);
};
process.env.https_proxy = 'http://127.0.0.1:3128';
main();
0.2.0

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago