Allow wss & https endpoints (#96)

This commit is contained in:
Jaco Greeff
2018-05-29 15:54:13 +02:00
committed by GitHub
parent d1b924b7c7
commit 2246f866f8
4 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ const l = require('@polkadot/util/logger')('api-http');
const coder = require('../coder/json');
module.exports = function state (endpoint: string): HttpState {
assert(/^http:\/\//.test(endpoint), `Endpoint should start with 'http://', received '${endpoint}'`);
assert(/^(https|http):\/\//.test(endpoint), `Endpoint should start with 'http://', received '${endpoint}'`);
return {
coder: coder(),
@@ -10,4 +10,10 @@ describe('state', () => {
() => state('ws://')
).toThrow(/with 'http/);
});
it('allows https:// endpoints', () => {
expect(
state('https://')
).toBeDefined();
});
});
+1 -1
View File
@@ -12,7 +12,7 @@ const l = require('@polkadot/util/logger')('api-ws');
const coder = require('../coder/json');
module.exports = function state (endpoint: string, autoConnect: boolean): $Shape<WsState> {
assert(/^ws:\/\//.test(endpoint), `Endpoint should start with 'ws://', received '${endpoint}'`);
assert(/^(wss|ws):\/\//.test(endpoint), `Endpoint should start with 'ws://', received '${endpoint}'`);
return {
autoConnect,
@@ -10,4 +10,10 @@ describe('state', () => {
() => state('http://')
).toThrow(/with 'ws/);
});
it('allows wss:// endpoints', () => {
expect(
state('wss://')
).toBeDefined();
});
});