Skip to content

Commit 063c02f

Browse files
jgoelenGacko
authored andcommitted
Add Equal func for customheaders.Config
1 parent 69fd353 commit 063c02f

File tree

1 file changed

+13
-0
lines changed
  • internal/ingress/annotations/customheaders

1 file changed

+13
-0
lines changed

internal/ingress/annotations/customheaders/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package customheaders
1818

1919
import (
2020
"fmt"
21+
"reflect"
2122
"regexp"
2223

2324
"k8s.io/klog/v2"
@@ -35,6 +36,18 @@ type Config struct {
3536
Headers map[string]string `json:"headers,omitempty"`
3637
}
3738

39+
// Equal tests for equality between two Config types
40+
func (c1 *Config) Equal(c2 *Config) bool {
41+
if c1 == c2 {
42+
return true
43+
}
44+
if c1 == nil || c2 == nil {
45+
return false
46+
}
47+
48+
return reflect.DeepEqual(c1.Headers, c2.Headers)
49+
}
50+
3851
var (
3952
headerRegexp = regexp.MustCompile(`^[a-zA-Z\d\-_]+$`)
4053
valueRegexp = regexp.MustCompile(`^[a-zA-Z\d_ :;.,\\/"'?!(){}\[\]@<>=\-+*#$&\x60|~^%]+$`)

0 commit comments

Comments
 (0)