bologet
v1.0.4
Published
boloto request module
Downloads
2
Maintainers
Readme
Bologet
Boloto http request module
Install
# npm
npm i bologet
# yarn
yarn add bologet
# pnpm
pnpm i bologet
API
const bologet=require('bologet')
bologet('https://github.com/', {
// http request method
method: 'GET',
// port
port: 80,
// request headers
headers: {
referer: 'https://github.com/'
},
// redirect limit count,
// if 0, no redirect
redirect: 3,
// retry limit count,
// if 0, no retry when error
retry: 3,
// cookie
// allow object or an array from http response
cookie: {
ssid: '1234'
},
// timeout, default 300000
timeout: 3000,
// encoding, default utf8
encoding: 'utf8',
// proxy
proxy: 'http://127.0.0.1:1080',
// finish callback, default console.log
// @returns {object | Error} res
// res.headers headers
// res.code status code
// res.string stringify content
// res.buffer Buffer
// res.cookie cookie
callback: console.log,
// data readstream will send,
// supported form-data module
formData: xxx,
// supported readstream, string or buffer
data: xxx,
// return response stream
stream: true
})