ata

0.3.3 • Public • Published
ata

npm LICENSE

  • axios + auto encode url + ...
  • fetch style requests with $ prefixed methods, like axios-module
  • support string proxy config like 127.0.0.1:9000

Install

yarn add ata
# or 
npm install ata

Usage

const Ata = require('ata')
 
const url = 'http://httpbin.org/get?show_env=1'
 
async function go() {
  // const { data } = await Ata.get(url)
  const data = await Ata.$get(url)
 
  console.log(data)
}
 
go()

random useragent with random-mua

const Ata = require('ata')
const randomMua = require('random-mua')
 
Ata.interceptors.request.use(
  function(config) {
    if (!config.headers['User-Agent']) {
      config.headers['User-Agent'] = randomMua()
    }
    return config
  },
  function(error) {
    return Promise.reject(error)
  }
)

License

Anti 996

Package Sidebar

Install

npm i ata

Weekly Downloads

1

Version

0.3.3

License

Anti 996

Unpacked Size

3.1 kB

Total Files

5

Last publish

Collaborators

  • yahtnif
  • o_0