Skip to content

Commit

Permalink
Add support for http protocol requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nechaido authored Jun 18, 2021
1 parent c9dc8cb commit 90eb7db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Metacom extends EventEmitter {
const target = interfaceName + '/' + methodName;
const packet = { call: callId, [target]: args };
const dest = new URL(this.url);
const protocol = dest.protocol === 'ws:' ? 'http' : 'https';
const protocol = ['ws:', 'http:'].includes(dest.protocol) ? 'http' : 'https';
const url = `${protocol}://${dest.host}/api`;
return fetch(url, {
method: 'POST',
Expand Down

0 comments on commit 90eb7db

Please sign in to comment.