File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ export class Client {
4646 * @return this
4747 */
4848 setEndpoint(endpoint: string): this {
49+ if (!endpoint || typeof endpoint !== 'string') {
50+ throw new {{spec .title | caseUcfirst }}Exception('Endpoint must be a valid string');
51+ }
52+
4953 if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
5054 throw new {{spec .title | caseUcfirst }}Exception('Invalid endpoint URL: ' + endpoint);
5155 }
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ class Client {
9696 * @returns {this}
9797 */
9898 setEndpoint(endpoint: string): this {
99+ if (!endpoint || typeof endpoint !== 'string') {
100+ throw new {{spec .title | caseUcfirst }}Exception('Endpoint must be a valid string');
101+ }
102+
99103 if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
100104 throw new {{spec .title | caseUcfirst }}Exception('Invalid endpoint URL: ' + endpoint);
101105 }
Original file line number Diff line number Diff line change @@ -129,6 +129,10 @@ class Client {
129129 * @returns {this}
130130 */
131131 setEndpoint(endpoint: string): this {
132+ if (!endpoint || typeof endpoint !== 'string') {
133+ throw new {{spec .title | caseUcfirst }}Exception('Endpoint must be a valid string');
134+ }
135+
132136 if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
133137 throw new {{spec .title | caseUcfirst }}Exception('Invalid endpoint URL: ' + endpoint);
134138 }
@@ -147,6 +151,10 @@ class Client {
147151 * @returns {this}
148152 */
149153 setEndpointRealtime(endpointRealtime: string): this {
154+ if (!endpointRealtime || typeof endpointRealtime !== 'string') {
155+ throw new {{spec .title | caseUcfirst }}Exception('Endpoint must be a valid string');
156+ }
157+
150158 if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
151159 throw new {{spec .title | caseUcfirst }}Exception('Invalid realtime endpoint URL: ' + endpointRealtime);
152160 }
Original file line number Diff line number Diff line change @@ -334,6 +334,10 @@ class Client {
334334 * @returns {this}
335335 */
336336 setEndpoint(endpoint: string): this {
337+ if (!endpoint || typeof endpoint !== 'string') {
338+ throw new {{spec .title | caseUcfirst }}Exception('Endpoint must be a valid string');
339+ }
340+
337341 if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
338342 throw new {{spec .title | caseUcfirst }}Exception('Invalid endpoint URL: ' + endpoint);
339343 }
@@ -352,6 +356,10 @@ class Client {
352356 * @returns {this}
353357 */
354358 setEndpointRealtime(endpointRealtime: string): this {
359+ if (!endpointRealtime || typeof endpointRealtime !== 'string') {
360+ throw new {{spec .title | caseUcfirst }}Exception('Endpoint must be a valid string');
361+ }
362+
355363 if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
356364 throw new {{spec .title | caseUcfirst }}Exception('Invalid realtime endpoint URL: ' + endpointRealtime);
357365 }
You can’t perform that action at this time.
0 commit comments