Package Exports
- replace-url-protocol
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (replace-url-protocol) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
README.md
helper for avoid node.js can't update protocol for some urlsee https://github.com/nodejs/node/issues/39732
install
yarn add replace-url-protocol
yarn-tool replace set-url-protocol
yt add replace-url-protocolimport { 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);
});
})