File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package customheaders
1818
1919import (
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+
3851var (
3952 headerRegexp = regexp .MustCompile (`^[a-zA-Z\d\-_]+$` )
4053 valueRegexp = regexp .MustCompile (`^[a-zA-Z\d_ :;.,\\/"'?!(){}\[\]@<>=\-+*#$&\x60|~^%]+$` )
Original file line number Diff line number Diff line change @@ -467,6 +467,10 @@ func (l1 *Location) Equal(l2 *Location) bool {
467467 return false
468468 }
469469
470+ if ! l1 .CustomHeaders .Equal (& l2 .CustomHeaders ) {
471+ return false
472+ }
473+
470474 return true
471475}
472476
Original file line number Diff line number Diff line change 302302 "validationDepth" : 0
303303 },
304304 "use-port-in-redirects" : false ,
305- "configuration-snippet" : " "
305+ "configuration-snippet" : " " ,
306+ "customHeaders" : {
307+ "headers" : {
308+ "Server" : " HAL9000"
309+ }
310+ }
306311 }]
307312 }, {
308313 "hostname" : " dev.mycompany.com" ,
Original file line number Diff line number Diff line change 302302 "validationDepth" : 0
303303 },
304304 "use-port-in-redirects" : false ,
305- "configuration-snippet" : " "
305+ "configuration-snippet" : " " ,
306+ "customHeaders" : {
307+ "headers" : {
308+ "Server" : " HAL9000"
309+ }
310+ }
306311 }]
307312 }, {
308313 "hostname" : " dev.mycompany.com" ,
You can’t perform that action at this time.
0 commit comments