Skip to content

Commit

Permalink
Merge pull request #429 from roidelapluie/fix-marshal
Browse files Browse the repository at this point in the history
Fix marshalling of TLSVersion
  • Loading branch information
roidelapluie committed Feb 21, 2023
2 parents 2c9877d + 1c521dc commit ff69f32
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions config/http_config.go
Original file line number Diff line number Diff line change
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

0 comments on commit ff69f32

Please sign in to comment.