Minor cleanup on connection request authentication code.
This commit is contained in:
1 parent
3c7f554264
commit
a8ee773a39
2 files changed
+8
-6
No files matched your search
@@ -9,11 +9,12 @@ auth = require './auth'
|
||||
|
||||
connectionRequest = (deviceId, callback) ->
|
||||
conReq = (url, authString, callback) ->
|
||||
if authString
|
||||
url = URL.parse(url)
|
||||
url.headers = {'Authorization' : authString}
|
||||
options = URL.parse(url)
|
||||
|
||||
request = http.get(url, (res) ->
|
||||
if authString
|
||||
options.headers = {'Authorization' : authString}
|
||||
|
||||
request = http.get(options, (res) ->
|
||||
if res.statusCode == 401
|
||||
authHeader = auth.parseAuthHeader(res.headers['www-authenticate'])
|
||||
callback(res.statusCode, authHeader)
|
||||
|
||||
Reference in new issue
Block a user