loopback-example-offline-sync icon indicating copy to clipboard operation
loopback-example-offline-sync copied to clipboard

Request expects at least host or hostname, but none given in browser mode

Open Morriz opened this issue 11 years ago • 4 comments

The todo app's 'sync' button throws this error:

Uncaught Error: Invalid URI "/api/Todos/checkpoint"

And debugging I find that Request fails on this line:

if (!(self.uri.host || (self.uri.hostname && self.uri.port)) && !self.uri.isUnix) {

since we only call with a relative path.

Should it be necessary to make requests with an absolute uri? That would be silly for browsers, but if must for now, so be it...

Morriz avatar May 29 '15 01:05 Morriz

Should it be necessary to make requests with an absolute uri? That would be silly for browsers, but if must for now, so be it...

Hmm, that's rather unfortunate :( Perhaps we can use window.location.host when running in a browser? Ideally this change should be made directly in the request module.

@Morriz would you mind submitting the patch yourself?

bajtos avatar Jun 02 '15 14:06 bajtos

Sure, when I have the time. I already realized that the Request repo is where it should go :)

On 2 jun. 2015, at 16:16, Miroslav Bajtoš [email protected] wrote:

Should it be necessary to make requests with an absolute uri? That would be silly for browsers, but if must for now, so be it...

Hmm, that's rather unfortunate :( Perhaps we can use window.location.host when running in a browser? Ideally this change should be made directly in the request module.

@Morriz https://github.com/Morriz would you mind submitting the patch yourself?

— Reply to this email directly or view it on GitHub https://github.com/strongloop/loopback-example-offline-sync/issues/69#issuecomment-107970116.

Morriz avatar Jun 02 '15 14:06 Morriz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 23 '17 14:08 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Sep 06 '17 14:09 stale[bot]