     yes
   else
     no
+
+sendBody = (res, body)->
+  res.set 'Content-Type', 'application/json'
+  return res.send 200, body
+
 
 module.exports = (req, res, next) ->
   { params, query } = req


  # piece the url together from the config:
  url = "#{ protocol }//#{ hostname }#{ if port then ":#{port}" else "" }"

failover = (req, res, multi) ->
  if req.params.service in supportedServices

      else ''
    }"

    request url, (error, response, body) ->
      if not error and response.statusCode is 200 and body

        # we can query for multiple services
        if multi
          try kontrolResponse = JSON.parse body

          if Array.isArray kontrolResponse
            if kontrolResponse.length isnt 0
              return sendBody res, body

        # if query is not multiple then
        # no need for checking array length
        else return sendBody res, body

      return  if failover req, res, multi
      return next()

  else next()  unless failover req, res, multi
