mirror of https://github.com/k3s-io/k3s
commit
7b5136ee73
|
@ -643,6 +643,7 @@ func (r *Request) Watch() (watch.Interface, error) {
|
|||
return nil, err
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
defer resp.Body.Close()
|
||||
if result := r.transformResponse(resp, req); result.err != nil {
|
||||
return nil, result.err
|
||||
}
|
||||
|
|
|
@ -477,7 +477,10 @@ func TestRequestWatch(t *testing.T) {
|
|||
Request: &Request{
|
||||
content: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()},
|
||||
client: clientFunc(func(req *http.Request) (*http.Response, error) {
|
||||
return &http.Response{StatusCode: http.StatusForbidden}, nil
|
||||
return &http.Response{
|
||||
StatusCode: http.StatusForbidden,
|
||||
Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
|
||||
}, nil
|
||||
}),
|
||||
baseURL: &url.URL{},
|
||||
},
|
||||
|
@ -490,7 +493,10 @@ func TestRequestWatch(t *testing.T) {
|
|||
Request: &Request{
|
||||
content: ContentConfig{GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()},
|
||||
client: clientFunc(func(req *http.Request) (*http.Response, error) {
|
||||
return &http.Response{StatusCode: http.StatusUnauthorized}, nil
|
||||
return &http.Response{
|
||||
StatusCode: http.StatusUnauthorized,
|
||||
Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
|
||||
}, nil
|
||||
}),
|
||||
baseURL: &url.URL{},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue