mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #56] Cannot use localhost as base url #19
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @profran on GitHub (Aug 25, 2019).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/56
Describe the bug
Unable to use 'localhost' as base url.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the Send button to be enabled
Desktop (please complete the following information):
Additional context
I cloned the repo and I think the issue is related to pages/index.vue line 247 on urlNotValid's validation pattern, I changed the return statement to always be false, and the problem was solved.
@liyasthomas commented on GitHub (Aug 25, 2019):
This might be a possibile duplicate of #2
Its a restriction due to the CORS (Cross Origin Request Policy), there isn't a client side work around to this unless the host your trying to access should respond with the appropriate CORS headers.
Please refer to docs here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Quick solution is to use a HTTPS API host, which supports CORS
@profran commented on GitHub (Aug 25, 2019):
I first thought of that, but my Node.js API is configured to support CORS requests. I'm sure it's just the URL validation's pattern which expects an URL with a domain at the end (any_url + .com .co .ar .jp ...). I'll see if I can open a PR to solve the problem tomorrow.
@liyasthomas commented on GitHub (Aug 25, 2019):
If that's the case, I'll surely look into it. You're welcomed to open a PR to fix it.
@NBTX commented on GitHub (Aug 25, 2019):
Ah yes, I know the issue, I had to mess with the regex to get websockets to work. I'll see if I can find some more permissive ones - and I'll add in IP addresses.
@liyasthomas commented on GitHub (Aug 25, 2019):
You could've opted to use two regex for URLValidation() 🤭
@NBTX commented on GitHub (Aug 25, 2019):
Yes, that was probably how I'd do it.
That said - is validation even necessary? Perhaps it would be ideal to just show an error if it fails to connect, like the websockets do, then to handle each edge case in regexes?
@liyasthomas commented on GitHub (Aug 25, 2019):
Sooner or later, URL validation will be necessary. Anyway let's discuss.
@NBTX commented on GitHub (Aug 25, 2019):
Okay. I'll update the url validation to include the two regex checks in the mean time.
@liyasthomas commented on GitHub (Aug 25, 2019):
@NBTX sendRequest() isn't firing. Can you check changes on URL validation
@NBTX commented on GitHub (Aug 25, 2019):
Solved by #58