mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #25332 from wojtek-t/fix_protobuf_failures
Fix protobuf failures
This commit is contained in:
		@@ -648,6 +648,7 @@ func (r *Request) Watch() (watch.Interface, error) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	req.Header = r.headers
 | 
			
		||||
	client := r.client
 | 
			
		||||
	if client == nil {
 | 
			
		||||
		client = http.DefaultClient
 | 
			
		||||
@@ -715,6 +716,7 @@ func (r *Request) Stream() (io.ReadCloser, error) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	req.Header = r.headers
 | 
			
		||||
	client := r.client
 | 
			
		||||
	if client == nil {
 | 
			
		||||
		client = http.DefaultClient
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,33 @@ func TestNewRequestSetsAccept(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type clientFunc func(req *http.Request) (*http.Response, error)
 | 
			
		||||
 | 
			
		||||
func (f clientFunc) Do(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return f(req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestRequestSetsHeaders(t *testing.T) {
 | 
			
		||||
	server := clientFunc(func(req *http.Request) (*http.Response, error) {
 | 
			
		||||
		if req.Header.Get("Accept") != "application/other, */*" {
 | 
			
		||||
			t.Errorf("unexpected headers: %#v", req.Header)
 | 
			
		||||
		}
 | 
			
		||||
		return &http.Response{
 | 
			
		||||
			StatusCode: http.StatusForbidden,
 | 
			
		||||
			Body:       ioutil.NopCloser(bytes.NewReader([]byte{})),
 | 
			
		||||
		}, nil
 | 
			
		||||
	})
 | 
			
		||||
	config := defaultContentConfig()
 | 
			
		||||
	config.ContentType = "application/other"
 | 
			
		||||
	serializers := defaultSerializers()
 | 
			
		||||
	r := NewRequest(server, "get", &url.URL{Path: "/path"}, "", config, serializers, nil, nil)
 | 
			
		||||
 | 
			
		||||
	// Check if all "issue" methods are setting headers.
 | 
			
		||||
	_ = r.Do()
 | 
			
		||||
	_, _ = r.Watch()
 | 
			
		||||
	_, _ = r.Stream()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestRequestWithErrorWontChange(t *testing.T) {
 | 
			
		||||
	original := Request{
 | 
			
		||||
		err:     errors.New("test"),
 | 
			
		||||
@@ -463,12 +490,6 @@ func TestTransformUnstructuredError(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type clientFunc func(req *http.Request) (*http.Response, error)
 | 
			
		||||
 | 
			
		||||
func (f clientFunc) Do(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return f(req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestRequestWatch(t *testing.T) {
 | 
			
		||||
	testCases := []struct {
 | 
			
		||||
		Request *Request
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user