consul.js
function inHandler (err, res, next) {
          if (err) return next()

          // resilient.js sometimes calls the middleware function more than once, with the output
          // of the previous invokation; checking here the type of the items in the response to
          // only call `mapServers` with service objects, not URLs (strings)
          if (Array.isArray(res.data) && Object(res.data[0]) === res.data[0]) {
            res.data = mapServers(res.data)
          }

          next()
        }
function inHandler (err, res, next) {
          if (err) return next()

          // resilient.js sometimes calls the middleware function more than once, with the output
          // of the previous invokation; checking here the type of the items in the response to
          // only call `mapServers` with service objects, not URLs (strings)
          if (Array.isArray(res.data) && Object(res.data[0]) === res.data[0]) {
            res.data = mapServers(res.data)
          }

          next()
        }
Incoming traffic middleware