Can anyone figure out why I get
TypeError: getStatusCode(...) is not a function
when I do?
const getStatusCode = require('./getStatusCode')
tmpStatus = await getStatusCode({url: url, timeOut: to, maxRedirects: mr})
(tmpStatus === alert['Check']['Status_code'] ) ? isOk = 1 : isOk = 0
The problem goes any if I remove the last line, where I check the value in tmpStatus.
getStatusCode.js
const axios = require('axios')
const qs = require('qs')
module.exports = async function(options) => {
  options              = options || {}
  options.url          = options.url || {}
  options.string       = options.string || null
  options.timeOut      = options.timeOut || 1000
  options.maxRedirects = options.maxRedirects || 0
  try {
    const response = await axios.get(options.url, {
      timeout: options.timeout,
      maxRedirects: options.maxRedirects,
      validateStatus: null,
      transformResponse: [function (data) {
        return data.search(options.string)
  }],
    })
    return await response.data
  } catch (error) {
    return -1
  }
}
 
     
    