How to use the fabric-ca-client/lib/FabricCAClientImpl._parseURL function in fabric-ca-client

To help you get started, we’ve selected a few fabric-ca-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / test / unit / headless-tests.js View on Github external
function () {
			FabricCAServices._parseURL(badURL3);
		},
		/InvalidURL: url must start with http or https./,
github hyperledger / fabric-sdk-node / test / unit / headless-tests.js View on Github external
var goodHost = 'www.example.com';
	var goodPort = 7054;
	var goodURL = 'http://' + goodHost + ':' + goodPort;
	var goodURLSecure = 'https://' + goodHost + ':' + goodPort;

	var badHost = '';
	var badURL = 'http://' + badHost + ':' + goodPort;
	var badURL2 = 'httpD://' + goodHost + ':' + goodPort;
	var badURL3 = 'httpsD://' + goodHost + ':' + goodPort;
	var badURL4 = goodHost + ':' + goodPort;


	t.plan(10);

	//valid http endpoint
	var endpointGood = FabricCAServices._parseURL(goodURL);
	t.equals(endpointGood.protocol, 'http', 'Check that protocol is set correctly to \'http\'');
	t.equals(endpointGood.hostname, goodHost, 'Check that hostname is set correctly');
	t.equals(endpointGood.port, goodPort, 'Check that port is set correctly');

	//valid https endpoint
	var endpointGoodSecure = FabricCAServices._parseURL(goodURLSecure);
	t.equals(endpointGoodSecure.protocol, 'https', 'Check that protocol is set correctly to \'https\'');
	t.equals(endpointGoodSecure.hostname, goodHost, 'Check that hostname is set correctly');
	t.equals(endpointGoodSecure.port, goodPort, 'Check that port is set correctly');

	//check invalid endpoints
	t.throws(
		function () {
			FabricCAServices._parseURL(badURL);
		},
		/InvalidURL: missing hostname./,
github hyperledger / fabric-sdk-node / test / unit / headless-tests.js View on Github external
var badURL = 'http://' + badHost + ':' + goodPort;
	var badURL2 = 'httpD://' + goodHost + ':' + goodPort;
	var badURL3 = 'httpsD://' + goodHost + ':' + goodPort;
	var badURL4 = goodHost + ':' + goodPort;


	t.plan(10);

	//valid http endpoint
	var endpointGood = FabricCAServices._parseURL(goodURL);
	t.equals(endpointGood.protocol, 'http', 'Check that protocol is set correctly to \'http\'');
	t.equals(endpointGood.hostname, goodHost, 'Check that hostname is set correctly');
	t.equals(endpointGood.port, goodPort, 'Check that port is set correctly');

	//valid https endpoint
	var endpointGoodSecure = FabricCAServices._parseURL(goodURLSecure);
	t.equals(endpointGoodSecure.protocol, 'https', 'Check that protocol is set correctly to \'https\'');
	t.equals(endpointGoodSecure.hostname, goodHost, 'Check that hostname is set correctly');
	t.equals(endpointGoodSecure.port, goodPort, 'Check that port is set correctly');

	//check invalid endpoints
	t.throws(
		function () {
			FabricCAServices._parseURL(badURL);
		},
		/InvalidURL: missing hostname./,
		'Throw error for missing hostname'
	);

	t.throws(
		function () {
			FabricCAServices._parseURL(badURL2);
github hyperledger / fabric-sdk-node / test / unit / headless-tests.js View on Github external
function () {
			FabricCAServices._parseURL(badURL);
		},
		/InvalidURL: missing hostname./,
github hyperledger / fabric-sdk-node / test / unit / headless-tests.js View on Github external
function () {
			FabricCAServices._parseURL(badURL2);
		},
		/InvalidURL: url must start with http or https./,