[Pkg-javascript-commits] [node-stream-http] 87/208: Test handling of relative paths in urls

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 13 13:39:31 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stream-http.

commit bbf1fd81f08e382be12c9e23b4627642ce309a86
Author: John Hiesey <john at hiesey.com>
Date:   Thu Sep 10 22:37:04 2015 -0700

    Test handling of relative paths in urls
    
    This adds the test from #17.
---
 test/node/http-browserify.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/test/node/http-browserify.js b/test/node/http-browserify.js
index 7f75935..4cb6a12 100644
--- a/test/node/http-browserify.js
+++ b/test/node/http-browserify.js
@@ -3,7 +3,7 @@
 var test = require('tape')
 var url = require('url')
 
-var location = 'http://localhost:8081'
+var location = 'http://localhost:8081/foo/123'
 
 var noop = function() {}
 global.window = {}
@@ -97,6 +97,15 @@ test('Test ipv6 address', function(t) {
 	t.end()
 })
 
+test('Test relative path in url', function(t) {
+	var params = { path: './bar' }
+	var request = http.get(params, noop)
+
+	var resolved = url.resolve(location, request._opts.url)
+	t.equal(resolved, 'http://localhost:8081/foo/bar', 'Url should be correct')
+	t.end()
+})
+
 test('Cleanup', function (t) {
 	delete global.window
 	delete require.cache[moduleName]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git



More information about the Pkg-javascript-commits mailing list