Skip to content

Commit

Permalink
fix: unandled error while parsing URL
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoliveira committed Jun 10, 2024
1 parent dba47a7 commit 1133a97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.2
v0.4.1
6 changes: 5 additions & 1 deletion proxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ func NewService(name string, rawURL string) (Service, error) {
}

url, err := url.ParseRequestURI(rawURL)
if err != nil {
return Service{}, fmt.Errorf("Error parsing URL '%v': %v", rawURL, err)
}

isInvalidHostname := len(url.Hostname()) == 0 || strings.Contains(url.Hostname(), ":")
if err != nil || isInvalidHostname {
if isInvalidHostname {
return Service{}, fmt.Errorf("URL '%v' is invalid, example of valid URL 'http://example.com:8080'", rawURL)
}

Expand Down

0 comments on commit 1133a97

Please sign in to comment.