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
18
18
19
19
import (
20
20
"fmt"
21
+ "reflect"
21
22
"regexp"
22
23
23
24
"k8s.io/klog/v2"
@@ -35,6 +36,18 @@ type Config struct {
35
36
Headers map [string ]string `json:"headers,omitempty"`
36
37
}
37
38
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
+
38
51
var (
39
52
headerRegexp = regexp .MustCompile (`^[a-zA-Z\d\-_]+$` )
40
53
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 {
467
467
return false
468
468
}
469
469
470
+ if ! l1 .CustomHeaders .Equal (& l2 .CustomHeaders ) {
471
+ return false
472
+ }
473
+
470
474
return true
471
475
}
472
476
Original file line number Diff line number Diff line change 302
302
"validationDepth" : 0
303
303
},
304
304
"use-port-in-redirects" : false ,
305
- "configuration-snippet" : " "
305
+ "configuration-snippet" : " " ,
306
+ "customHeaders" : {
307
+ "headers" : {
308
+ "Server" : " HAL9000"
309
+ }
310
+ }
306
311
}]
307
312
}, {
308
313
"hostname" : " dev.mycompany.com" ,
Original file line number Diff line number Diff line change 302
302
"validationDepth" : 0
303
303
},
304
304
"use-port-in-redirects" : false ,
305
- "configuration-snippet" : " "
305
+ "configuration-snippet" : " " ,
306
+ "customHeaders" : {
307
+ "headers" : {
308
+ "Server" : " HAL9000"
309
+ }
310
+ }
306
311
}]
307
312
}, {
308
313
"hostname" : " dev.mycompany.com" ,
You can’t perform that action at this time.
0 commit comments