MCPcopy
hub / github.com/kubernetes/client-go / TestRequestSetsHeaders

Function TestRequestSetsHeaders

rest/request_test.go:75–94  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestRequestSetsHeaders(t *testing.T) {
76 server := clientFunc(func(req *http.Request) (*http.Response, error) {
77 if req.Header.Get("Accept") != "application/other, */*" {
78 t.Errorf("unexpected headers: %#v", req.Header)
79 }
80 return &http.Response{
81 StatusCode: http.StatusForbidden,
82 Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
83 }, nil
84 })
85 config := defaultContentConfig()
86 config.ContentType = "application/other"
87 serializers := defaultSerializers(t)
88 r := NewRequest(server, "get", &url.URL{Path: "/path"}, "", config, serializers, nil, nil, 0)
89
90 // Check if all "issue" methods are setting headers.
91 _ = r.Do()
92 _, _ = r.Watch()
93 _, _ = r.Stream()
94}
95
96func TestRequestWithErrorWontChange(t *testing.T) {
97 gvCopy := v1.SchemeGroupVersion

Callers

nothing calls this directly

Calls 9

DoMethod · 0.95
WatchMethod · 0.95
StreamMethod · 0.95
clientFuncFuncType · 0.85
defaultContentConfigFunction · 0.85
defaultSerializersFunction · 0.85
NewRequestFunction · 0.85
GetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected