             "Content-type": "application/json"
         }
     }
+    if user_id and api_key
+        options.path = addQSParm(options.path, "user_id", user_id)
+        options.path = addQSParm(options.path, "api_key", api_key)
+
     return options
 
 describe('API Integration tests:', () ->

        )
    )

    it('should authenticate a user', (done) ->
        qstring = JSON.stringify({
            "username": "test",
            "password": "test"
        })
        options = defaultQueryOptions('/login', 'POST')
        req = http.request(options)
        req.on('response', (res) ->
            res.on('data', (data) ->

port = 4000
user_id = null
api_key = null

addQSParm = (url, name, value) ->
    re = new RegExp("([?&]" + name + "=)[^&]+", "")

    add = (sep) ->
        url += sep + name + "=" + encodeURIComponent(value)

    change = () ->
        url = url.replace(re, "$1" + encodeURIComponent(value))

    if (url.indexOf("?") == -1)
        add("?")
    else
        if (re.test(url))
            change()
        else
            add("&")

    return url

defaultQueryOptions = (path, method) ->
    options = {
