@@ -20,7 +20,7 @@ func TestGetDefaultMiddleWareWithMultipleOptions(t *testing.T) {
20
20
return true
21
21
},
22
22
}
23
- compressionOptions := NewCompressionOptions (false )
23
+ compressionOptions := NewCompressionOptionsReference (false )
24
24
parametersNameDecodingOptions := ParametersNameDecodingOptions {
25
25
Enable : true ,
26
26
ParametersToDecode : []byte {'-' , '.' , '~' , '$' },
@@ -36,7 +36,7 @@ func TestGetDefaultMiddleWareWithMultipleOptions(t *testing.T) {
36
36
}
37
37
options , err := GetDefaultMiddlewaresWithOptions (& retryOptions ,
38
38
& redirectHandlerOptions ,
39
- & compressionOptions ,
39
+ compressionOptions ,
40
40
& parametersNameDecodingOptions ,
41
41
& userAgentHandlerOptions ,
42
42
& headersInspectionOptions ,
@@ -67,19 +67,28 @@ func TestGetDefaultMiddleWareWithInvalidOption(t *testing.T) {
67
67
}
68
68
69
69
func TestGetDefaultMiddleWareWithOptions (t * testing.T ) {
70
+ compression := NewCompressionOptionsReference (false )
71
+ options , err := GetDefaultMiddlewaresWithOptions (compression )
72
+ verifyMiddlewareWithDisabledCompression (t , options , err )
73
+ }
74
+
75
+ func TestGetDefaultMiddleWareWithOptionsDeprecated (t * testing.T ) {
70
76
compression := NewCompressionOptions (false )
71
- options , err := GetDefaultMiddlewaresWithOptions (& compression )
77
+ options , err := GetDefaultMiddlewaresWithOptions (compression )
78
+ verifyMiddlewareWithDisabledCompression (t , options , err )
79
+ }
80
+
81
+ func verifyMiddlewareWithDisabledCompression (t * testing.T , options []Middleware , err error ) {
72
82
if err != nil {
73
83
t .Errorf (err .Error ())
74
84
}
75
85
if len (options ) != 6 {
76
86
t .Errorf ("expected 6 middleware, got %v" , len (options ))
77
87
}
78
-
79
88
for _ , element := range options {
80
89
switch v := element .(type ) {
81
90
case * CompressionHandler :
82
- assert .Equal (t , v .options .ShouldCompress (), compression . ShouldCompress () )
91
+ assert .Equal (t , v .options .ShouldCompress (), false )
83
92
}
84
93
}
85
94
}
0 commit comments