mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-24 13:31:36 +00:00
Support passing through query params
This commit is contained in:
parent
a32762bba1
commit
7e358ab318
3 changed files with 13 additions and 2 deletions
|
@ -23,4 +23,11 @@ module.exports = RedirectManager =
|
|||
url = target.url
|
||||
if target.baseUrl?
|
||||
url = "#{target.baseUrl}#{url}"
|
||||
res.redirect code, url
|
||||
res.redirect code, url + getQueryString(req)
|
||||
|
||||
# Naively get the query params string. Stringifying the req.query object may
|
||||
# have differences between Express and Rails, so safer to just pass the raw
|
||||
# string
|
||||
getQueryString = (req) ->
|
||||
qs = req.url.match(/\?.*$/)
|
||||
if qs? then qs[0] else ""
|
||||
|
|
|
@ -29,3 +29,6 @@ describe "RedirectUrls", ->
|
|||
|
||||
it 'proxy URLs with multiple support methods', (done) ->
|
||||
assertRedirect 'get', '/redirect/get_and_post', 302, '/destination/get_and_post', done
|
||||
|
||||
it 'redirects with query params', (done) ->
|
||||
assertRedirect 'get', '/redirect/qs?foo=bar&baz[]=qux1&baz[]=qux2', 302, '/destination/qs?foo=bar&baz[]=qux1&baz[]=qux2', done
|
|
@ -125,4 +125,5 @@ module.exports =
|
|||
},
|
||||
'/redirect/params/:id': {
|
||||
url: (params) -> "/destination/#{params.id}/params"
|
||||
}
|
||||
},
|
||||
'/redirect/qs': '/destination/qs'
|
||||
|
|
Loading…
Reference in a new issue