mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 04:41:47 +00:00

Move non-standard methods to `url` module instead of exposing as static methods on the `URL` object. PR-URL: https://github.com/nodejs/node/pull/10512 Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
38 lines
696 B
JavaScript
38 lines
696 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const inspect = require('util').inspect;
|
|
const originFor = require('url').originFor;
|
|
|
|
assert.strictEqual(
|
|
inspect(originFor('http://test.com:8000')),
|
|
`TupleOrigin {
|
|
scheme: http,
|
|
host: test.com,
|
|
port: 8000,
|
|
domain: null
|
|
}`
|
|
);
|
|
|
|
assert.strictEqual(
|
|
inspect(originFor('http://test.com')),
|
|
`TupleOrigin {
|
|
scheme: http,
|
|
host: test.com,
|
|
port: undefined,
|
|
domain: null
|
|
}`
|
|
);
|
|
|
|
|
|
assert.strictEqual(
|
|
inspect(originFor('https://test.com')),
|
|
`TupleOrigin {
|
|
scheme: https,
|
|
host: test.com,
|
|
port: undefined,
|
|
domain: null
|
|
}`
|
|
);
|