Skip to content

Commit

Permalink
Add support for http protocol requests
Browse files Browse the repository at this point in the history
PR-URL: #198
  • Loading branch information
nechaido authored and tshemsedinov committed Jun 19, 2021
1 parent bb5f633 commit 9cf2be1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased][unreleased]

- Update Metacom exports
- Add support for `http ` protocol requests

## [1.7.3][] - 2021-06-08

Expand Down
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 = dest.protocol.endsWith('s') ? 'https' : 'http';
const url = `${protocol}://${dest.host}/api`;
return fetch(url, {
method: 'POST',
Expand Down

0 comments on commit 9cf2be1

Please sign in to comment.