Skip to content
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

Fix marshalling of TLSVersion #429

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 4 additions & 10 deletions config/http_config.go
Expand Up @@ -80,12 +80,9 @@ func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error {
return fmt.Errorf("unknown TLS version: %s", s)
}

func (tv *TLSVersion) MarshalYAML() (interface{}, error) {
if tv == nil || *tv == 0 {
return []byte("null"), nil
}
func (tv TLSVersion) MarshalYAML() (interface{}, error) {
for s, v := range TLSVersions {
if *tv == v {
if tv == v {
return s, nil
}
}
Expand All @@ -106,12 +103,9 @@ func (tv *TLSVersion) UnmarshalJSON(data []byte) error {
}

// MarshalJSON implements the json.Marshaler interface for TLSVersion.
func (tv *TLSVersion) MarshalJSON() ([]byte, error) {
if tv == nil || *tv == 0 {
return []byte("null"), nil
}
func (tv TLSVersion) MarshalJSON() ([]byte, error) {
for s, v := range TLSVersions {
if *tv == v {
if tv == v {
return []byte(s), nil
}
}
Expand Down