mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Monkey patch request in smoke tests to work around secnding secure cookie over HTTP
This commit is contained in:
parent
d41807e667
commit
9f966996be
1 changed files with 8 additions and 6 deletions
|
@ -1,18 +1,23 @@
|
|||
chai = require("chai")
|
||||
chai.should()
|
||||
expect = chai.expect
|
||||
request = require "request"
|
||||
Settings = require "settings-sharelatex"
|
||||
|
||||
# Monkey patch request cookies, because the new tough-cookie module
|
||||
# assumes it's not a secure cookie if the url is not HTTPS
|
||||
request = require "request"
|
||||
jar = request.jar()
|
||||
jar.getCookieString = (uri) ->
|
||||
return @_jar.getCookieStringSync uri, secure: true
|
||||
request = request.defaults jar: jar
|
||||
|
||||
port = Settings.internal?.web?.port or Settings.port or 3000
|
||||
buildUrl = (path) -> "http://localhost:#{port}/#{path}"
|
||||
|
||||
describe "Opening", ->
|
||||
before (done) ->
|
||||
@jar = request.jar()
|
||||
request.get {
|
||||
url: buildUrl("register")
|
||||
jar: @jar
|
||||
headers:
|
||||
"X-Forwarded-Proto": "https"
|
||||
}, (error, response, body) =>
|
||||
|
@ -23,7 +28,6 @@ describe "Opening", ->
|
|||
email: Settings.smokeTest.user
|
||||
password: Settings.smokeTest.password
|
||||
_csrf: csrf
|
||||
jar: @jar
|
||||
headers:
|
||||
"X-Forwarded-Proto": "https"
|
||||
}, (error, response, body) ->
|
||||
|
@ -33,7 +37,6 @@ describe "Opening", ->
|
|||
it "a project", (done) ->
|
||||
request {
|
||||
url: buildUrl("project/#{Settings.smokeTest.projectId}")
|
||||
jar: @jar
|
||||
headers:
|
||||
"X-Forwarded-Proto": "https"
|
||||
}, (error, response, body) ->
|
||||
|
@ -47,7 +50,6 @@ describe "Opening", ->
|
|||
it "the project list", (done) ->
|
||||
request {
|
||||
url: buildUrl("project")
|
||||
jar: @jar
|
||||
headers:
|
||||
"X-Forwarded-Proto": "https"
|
||||
}, (error, response, body) ->
|
||||
|
|
Loading…
Reference in a new issue