1.0.10 • Published 5 months ago

replace-url-protocol v1.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

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);
	});

})
1.0.10

5 months ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago