@jobscale/fetch

0.2.0 • Public • Published

@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();

Readme

Keywords

Package Sidebar

Install

npm i @jobscale/fetch

Weekly Downloads

2

Version

0.2.0

License

MIT

Unpacked Size

6.01 kB

Total Files

8

Last publish

Collaborators

  • jobscale