From 3c3d1d74d7c69de58422752b1a8f40bdc9731ba5 Mon Sep 17 00:00:00 2001 From: Jason Smylnycky Date: Wed, 28 Aug 2019 19:08:42 -0400 Subject: [PATCH] Checking in tests proving out the issues in 775 and 959, actual fixes coming soon... --- test/lib-http-proxy-common-test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/lib-http-proxy-common-test.js b/test/lib-http-proxy-common-test.js index 58233f7..d19a9fd 100644 --- a/test/lib-http-proxy-common-test.js +++ b/test/lib-http-proxy-common-test.js @@ -275,6 +275,30 @@ describe('lib/http-proxy/common.js', function () { expect(outgoing.path).to.eql('/some/crazy/path/whoooo'); }); + // Bugfix validation: 775, 959 + it.only('should ignore the path of the `req.url` passed in but use the target path with two unencoded urls as query parameters', function () { + var outgoing = {}; + var myEndpoint = 'https://whatever.com/some/crazy/path/whoooo?redirectTo=https://example.com&secondaryRedirect=https://test.com'; + common.setupOutgoing(outgoing, { + target: url.parse(myEndpoint), + ignorePath: true + }, { url: '/more/crazy/pathness' }); + + expect(outgoing.path).to.eql('/some/crazy/path/whoooo?redirectTo=https://example.com&secondaryRedirect=https://test.com'); + }); + + // Bugfix validation: 775, 959 + it.only('should ignore the path of the `req.url` passed in but use the target path with two unencoded slashes in a query parameter', function () { + var outgoing = {}; + var myEndpoint = 'https://whatever.com/some/crazy/path/whoooo?key=//myValue'; + common.setupOutgoing(outgoing, { + target: url.parse(myEndpoint), + ignorePath: true + }, { url: '/more/crazy/pathness' }); + + expect(outgoing.path).to.eql('/some/crazy/path/whoooo?key=//myValue'); + }); + it('and prependPath: false, it should ignore path of target and incoming request', function () { var outgoing = {}; var myEndpoint = 'https://whatever.com/some/crazy/path/whoooo';