Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Merge requests
  • !947
An error occurred while fetching the assigned milestone of the selected merge_request.

fix(common) urlJoin replace: ":/" -> "http?s:/"

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/coderaiser/fix-urlJoin into master 9 years ago
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: coderaiser

Shrunk replace options. Fix https://github.com/nodejitsu/node-http-proxy/issues/946.

Compare
  • master (base)

and
  • latest version
    7bad3fbc
    1 commit, 2 years ago

2 files
+ 26
- 1

    Preferences

    File browser
    Compare changes
lib/htt‎p-proxy‎
comm‎on.js‎ +4 -1
te‎st‎
lib-http-proxy‎-common-test.js‎ +22 -0
lib/http-proxy/common.js
+ 4
- 1
  • View file @ 7bad3fbc

  • Edit in single-file editor

  • Open in Web IDE


@@ -182,7 +182,10 @@ common.urlJoin = function() {
// joining e.g. ['', 'am']
//
retSegs = [
args.filter(Boolean).join('/').replace(/\/+/g, '/').replace(/:\//g, '://')
args.filter(Boolean).join('/')
.replace(/\/+/g, '/')
.replace('http:/', 'http://')
.replace('https:/', 'https://')
];
// Only join the query string if it exists so we don't have trailing a '?'
test/lib-http-proxy-common-test.js
+ 22
- 0
  • View file @ 7bad3fbc

  • Edit in single-file editor

  • Open in Web IDE


@@ -241,6 +241,28 @@ describe('lib/http-proxy/common.js', function () {
expect(outgoing.path).to.eql('/' + google);
});
it('should not replace :\ to :\\ when no https word before', function () {
var outgoing = {};
var google = 'https://google.com:/join/join.js'
common.setupOutgoing(outgoing, {
target: url.parse('http://sometarget.com:80'),
toProxy: true,
}, { url: google });
expect(outgoing.path).to.eql('/' + google);
});
it('should not replace :\ to :\\ when no http word before', function () {
var outgoing = {};
var google = 'http://google.com:/join/join.js'
common.setupOutgoing(outgoing, {
target: url.parse('http://sometarget.com:80'),
toProxy: true,
}, { url: google });
expect(outgoing.path).to.eql('/' + google);
});
describe('when using ignorePath', function () {
it('should ignore the path of the `req.url` passed in but use the target path', function () {
var outgoing = {};
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: github/fork/coderaiser/fix-urlJoin

Menu

Explore Projects Groups Snippets