Skip to content

Commit

Permalink
Use url.Parse instead of strings.Replace
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bell committed Jul 21, 2017
1 parent d9c026b commit bc27acb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions agent/wsclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package wsclient

import (
"io"
"net/url"
"os"
"strings"
"testing"

"github.com/aws/amazon-ecs-agent/agent/acs/model/ecsacs"
Expand Down Expand Up @@ -171,9 +171,10 @@ func TestHandleIncorrectURLScheme(t *testing.T) {
mockServer.StartTLS()
defer mockServer.Close()

mockServerURL := strings.Replace(mockServer.URL, "https", "notaparticularlyrealscheme", 1)
mockServerURL, _ := url.Parse(mockServer.URL)
mockServerURL.Scheme = "notaparticularlyrealscheme"

cs := getClientServer(mockServerURL)
cs := getClientServer(mockServerURL.String())
err := cs.Connect()

assert.Error(t, err, "Expected error for incorrect URL scheme")
Expand Down

0 comments on commit bc27acb

Please sign in to comment.