-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #328 from roidelapluie/no-marshal-http-secret
Do not marshal secrets in URL's
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1418,3 +1418,19 @@ func TestUnmarshalURL(t *testing.T) { | |
t.Fatalf("URL not properly unmarshaled in YAML, got '%s'", u.String()) | ||
} | ||
} | ||
|
||
func TestMarshalURLWithSecret(t *testing.T) { | ||
var u URL | ||
err := yaml.Unmarshal([]byte("http://foo:[email protected]"), &u) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
b, err := yaml.Marshal(u) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if strings.TrimSpace(string(b)) != "http://foo:[email protected]" { | ||
t.Fatalf("URL not properly marshaled in YAML, got '%s'", string(b)) | ||
} | ||
} |