Sha256: b47fa7a9f20b85873be1fd5ced3b09d3fa1c322e9bfa1552e425d44d37df0e2e
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
global.window = { location: { host: 'localhost:8081', port: 8081, protocol: 'http:' } }; var noop = function() {}; global.window.XMLHttpRequest = function() { this.open = noop; this.send = noop; }; var test = require('tape').test; var http = require('../index.js'); test('Test simple url string', function(t) { var url = { path: '/api/foo' }; var request = http.get(url, noop); t.equal( request.uri, 'http://localhost:8081/api/foo', 'Url should be correct'); t.end(); }); test('Test full url object', function(t) { var url = { host: "localhost:8081", hostname: "localhost", href: "http://localhost:8081/api/foo?bar=baz", method: "GET", path: "/api/foo?bar=baz", pathname: "/api/foo", port: "8081", protocol: "http:", query: "bar=baz", search: "?bar=baz", slashes: true }; var request = http.get(url, noop); t.equal( request.uri, 'http://localhost:8081/api/foo?bar=baz', 'Url should be correct'); t.end(); }); test('Test string as parameters', function(t) { var url = '/api/foo'; var request = http.get(url, noop); t.equal( request.uri, 'http://localhost:8081/api/foo', 'Url should be correct'); t.end(); })
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprockets-browserify-0.3.0 | node_modules/browserify/node_modules/http-browserify/test/request_url.js |