Update index.js
- added verbose mode - renamed http to instance (to avoid conflict in variable names)
This commit is contained in:
parent
11fb3cee97
commit
08a8c9526f
|
@ -2,6 +2,7 @@ const util = require('../helpers/util')
|
|||
const axios = require('axios')
|
||||
const https = require('https')
|
||||
|
||||
const verbose = true
|
||||
const errorLog = 'error.log'
|
||||
const config = {
|
||||
timeout: 60000,
|
||||
|
@ -14,13 +15,13 @@ let stats = {
|
|||
failures: 0
|
||||
}
|
||||
|
||||
const http = axios.create({
|
||||
const instance = axios.create({
|
||||
timeout: config.timeout,
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: false
|
||||
})
|
||||
})
|
||||
http.defaults.headers.common["User-Agent"] = "VLC/2.2.4 LibVLC/2.2.4"
|
||||
instance.defaults.headers.common["User-Agent"] = "VLC/2.2.4 LibVLC/2.2.4"
|
||||
|
||||
async function test() {
|
||||
|
||||
|
@ -52,7 +53,11 @@ async function test() {
|
|||
|
||||
try {
|
||||
|
||||
await http.get(item.url)
|
||||
if(verbose) {
|
||||
console.log(`Checking '${item.url}'...`)
|
||||
}
|
||||
|
||||
await instance.get(item.url)
|
||||
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in New Issue