@@ -8,6 +8,32 @@ import (
88type MiddlewareProcessor interface {
99 Process (config map [string ]interface {}) map [string ]interface {}
1010}
11+ type BufferingProcessor struct {}
12+
13+ // Process implements special handling for buffering middleware
14+ func (p * BufferingProcessor ) Process (config map [string ]interface {}) map [string ]interface {} {
15+ // Convert byte size fields from float64 to int
16+ byteFields := []string {
17+ "maxRequestBodyBytes" ,
18+ "memRequestBodyBytes" ,
19+ "maxResponseBodyBytes" ,
20+ "memResponseBodyBytes" ,
21+ }
22+
23+ for _ , field := range byteFields {
24+ if val , ok := config [field ].(float64 ); ok {
25+ // Convert to int if it's a whole number
26+ if val == float64 (int64 (val )) {
27+ config [field ] = int64 (val )
28+ } else {
29+ config [field ] = val
30+ }
31+ }
32+ }
33+
34+ // Process other buffering configuration values with general processor
35+ return preserveTraefikValues (config ).(map [string ]interface {})
36+ }
1137
1238// Registry of middleware processors
1339var middlewareProcessors = map [string ]MiddlewareProcessor {
@@ -27,6 +53,7 @@ var middlewareProcessors = map[string]MiddlewareProcessor{
2753 "inFlightReq" : & RateLimitProcessor {},
2854 "ipWhiteList" : & IPFilterProcessor {},
2955 "ipAllowList" : & IPFilterProcessor {},
56+ "buffering" : & BufferingProcessor {}, // ADD THIS LINE
3057 // Add more middleware types as needed
3158}
3259
0 commit comments