@@ -17,6 +17,7 @@ limitations under the License.
17
17
package rest
18
18
19
19
import (
20
+ "context"
20
21
"net/http"
21
22
"net/http/httptest"
22
23
"net/url"
@@ -79,7 +80,7 @@ func TestDoRequestSuccess(t *testing.T) {
79
80
if err != nil {
80
81
t .Fatalf ("unexpected error: %v" , err )
81
82
}
82
- body , err := c .Get ().Prefix ("test" ).Do ().Raw ()
83
+ body , err := c .Get ().Prefix ("test" ).Do (context . Background () ).Raw ()
83
84
84
85
testParam := TestParam {actualError : err , expectingError : false , expCreated : true ,
85
86
expStatus : status , testBody : true , testBodyErrorIsNotNil : false }
@@ -107,7 +108,7 @@ func TestDoRequestFailed(t *testing.T) {
107
108
if err != nil {
108
109
t .Fatalf ("unexpected error: %v" , err )
109
110
}
110
- err = c .Get ().Do ().Error ()
111
+ err = c .Get ().Do (context . Background () ).Error ()
111
112
if err == nil {
112
113
t .Errorf ("unexpected non-error" )
113
114
}
@@ -146,7 +147,7 @@ func TestDoRawRequestFailed(t *testing.T) {
146
147
if err != nil {
147
148
t .Fatalf ("unexpected error: %v" , err )
148
149
}
149
- body , err := c .Get ().Do ().Raw ()
150
+ body , err := c .Get ().Do (context . Background () ).Raw ()
150
151
151
152
if err == nil || body == nil {
152
153
t .Errorf ("unexpected non-error: %#v" , body )
@@ -170,7 +171,7 @@ func TestDoRequestCreated(t *testing.T) {
170
171
t .Fatalf ("unexpected error: %v" , err )
171
172
}
172
173
created := false
173
- body , err := c .Get ().Prefix ("test" ).Do ().WasCreated (& created ).Raw ()
174
+ body , err := c .Get ().Prefix ("test" ).Do (context . Background () ).WasCreated (& created ).Raw ()
174
175
175
176
testParam := TestParam {actualError : err , expectingError : false , expCreated : true ,
176
177
expStatus : status , testBody : false }
@@ -185,7 +186,7 @@ func TestDoRequestNotCreated(t *testing.T) {
185
186
t .Fatalf ("unexpected error: %v" , err )
186
187
}
187
188
created := false
188
- body , err := c .Get ().Prefix ("test" ).Do ().WasCreated (& created ).Raw ()
189
+ body , err := c .Get ().Prefix ("test" ).Do (context . Background () ).WasCreated (& created ).Raw ()
189
190
testParam := TestParam {actualError : err , expectingError : false , expCreated : false ,
190
191
expStatus : expectedStatus , testBody : false }
191
192
validate (testParam , t , body , fakeHandler )
@@ -200,7 +201,7 @@ func TestDoRequestAcceptedNoContentReturned(t *testing.T) {
200
201
t .Fatalf ("unexpected error: %v" , err )
201
202
}
202
203
created := false
203
- body , err := c .Get ().Prefix ("test" ).Do ().WasCreated (& created ).Raw ()
204
+ body , err := c .Get ().Prefix ("test" ).Do (context . Background () ).WasCreated (& created ).Raw ()
204
205
testParam := TestParam {actualError : err , expectingError : false , expCreated : false ,
205
206
testBody : false }
206
207
validate (testParam , t , body , fakeHandler )
@@ -214,7 +215,7 @@ func TestBadRequest(t *testing.T) {
214
215
t .Fatalf ("unexpected error: %v" , err )
215
216
}
216
217
created := false
217
- body , err := c .Get ().Prefix ("test" ).Do ().WasCreated (& created ).Raw ()
218
+ body , err := c .Get ().Prefix ("test" ).Do (context . Background () ).WasCreated (& created ).Raw ()
218
219
testParam := TestParam {actualError : err , expectingError : true , expCreated : false ,
219
220
testBody : true }
220
221
validate (testParam , t , body , fakeHandler )
0 commit comments