0.3.3 • Published 5 years ago

ata v0.3.3

Weekly downloads
33
License
Anti 996
Repository
github
Last release
5 years ago

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

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.0

7 years ago