use cookie key when setting cookie for jar

This commit is contained in:
Henry Oswald 2016-05-19 13:45:44 +01:00
parent 036b179ffe
commit 789257fd4a
2 changed files with 4 additions and 4 deletions

View file

@ -56,7 +56,7 @@ module.exports = ClsiCookieManager =
if err?
logger.err err:err, project_id:project_id, "error getting server id"
return callback(err)
serverCookie = request.cookie("clsiserver=#{serverId}")
serverCookie = request.cookie("#{Settings.clsiCookieKey}=#{serverId}")
jar = request.jar()
jar.setCookie serverCookie, Settings.apis.clsi.url
callback(null, jar)

View file

@ -112,9 +112,9 @@ describe "ClsiCookieManager", ->
@ClsiCookieManager._getServerId = sinon.stub().callsArgWith(1, null, "clsi-11")
it "should return a jar with the cookie set populated from redis", (done)->
@ClsiCookieManager.getCookieJar @project_id, (err, jar)->
jar._jar.store.idx["clsi.example.com"]["/"].clsiserver.key.should.equal "clsiserver"
jar._jar.store.idx["clsi.example.com"]["/"].clsiserver.value.should.equal "clsi-11"
@ClsiCookieManager.getCookieJar @project_id, (err, jar)=>
jar._jar.store.idx["clsi.example.com"]["/"][@settings.clsiCookieKey].key.should.equal
jar._jar.store.idx["clsi.example.com"]["/"][@settings.clsiCookieKey].value.should.equal "clsi-11"
done()