replace-url-protocol
v1.0.10
Published
helper for avoid node.js can't update protocol for some url
Downloads
354
Maintainers
Readme
README.md
helper for avoid node.js can't update protocol for some url
see https://github.com/nodejs/node/issues/39732
install
yarn add replace-url-protocol
yarn-tool replace set-url-protocol
yt add replace-url-protocol
import { replaceURLProtocol, replaceProtocol } from 'replace-url-protocol';
describe('node.js#39732', () =>
{
test(`git+https:`, () =>
{
let u = new URL( 'git+https://url-fake-hostname/zh-TW/scripts')
let expected = 'https:';
replaceURLProtocol(u, expected);
expect(u).toHaveProperty('protocol', expected);
});
test(`fake:`, () =>
{
let u = new URL( 'fake://url-fake-hostname/zh-TW/scripts')
let expected = 'https:';
replaceURLProtocol(u, expected);
expect(u).toHaveProperty('protocol', expected);
});
test(`fake+http:`, () =>
{
let u = new URL( 'fake+http://url-fake-hostname/zh-TW/scripts')
let expected = 'https:';
replaceURLProtocol(u, expected);
expect(u).toHaveProperty('protocol', expected);
});
})