8000 fix: allow capacitor:// scheme by dunglas · Pull Request #757 · dunglas/mercure · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: allow capacitor:// scheme #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"go.uber.org/zap"
)

var errInvalidOrigin = errors.New(`invalid origin, the URL must ward with "https" or "http"`)
var errInvalidOrigin = errors.New(`invalid origin, the URL must ward with "https", "http" or "capacitor"`)

// ErrUnsupportedProtocolVersion is returned when the version passed is unsupported.
var ErrUnsupportedProtocolVersion = errors.New("compatibility mode only supports protocol version 7")
Expand Down Expand Up @@ -170,7 +170,7 @@ func validateOrigins(origins []string) error {
}

switch u.Scheme {
case "http", "https":
case "http", "https", "capacitor":
default:
return errInvalidOrigin
}
Expand Down
2 changes: 2 additions & 0 deletions hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func TestOriginsValidator(t *testing.T) {
{"https://example.com", "http://example.org"},
{"https://example.com", "*"},
{"null", "https://example.com:3000"},
{"capacitor://"},
{"capacitor://www.example.com"},
}

invalidOrigins := [][]string{
Expand Down
0