@@ -67,7 +67,7 @@ func (mrt *manifestRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
6767
6868 isDiscovery := isServerGroupResourceDiscovery (requestInfo .Path )
6969 if ! requestInfo .IsResourceRequest && ! isDiscovery {
70- return nil , fmt .Errorf ("non-resource requests are not supported by this implementation" )
70+ return nil , fmt .Errorf ("non-resource requests are not supported by this implementation: %q" , requestInfo . Path )
7171 }
7272 if len (requestInfo .Subresource ) != 0 {
7373 return nil , fmt .Errorf ("subresource %v is not supported by this implementation" , requestInfo .Subresource )
@@ -113,7 +113,9 @@ func (mrt *manifestRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
113113 return nil , fmt .Errorf ("verb %v is not supported by this implementation" , requestInfo .Verb )
114114 }
115115
116- resp := & http.Response {}
116+ resp := & http.Response {
117+ Header : map [string ][]string {},
118+ }
117119 switch {
118120 case apierrors .IsNotFound (returnErr ):
119121 resp .StatusCode = http .StatusNotFound
@@ -129,7 +131,11 @@ func (mrt *manifestRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
129131 resp .Body = io .NopCloser (bytes .NewReader (returnBody ))
130132 // We always return application/json. Avoid clients expecting proto for built-ins.
131133 resp .Header = make (http.Header )
132- resp .Header .Set ("Content-Type" , "application/json" )
134+ if isDiscovery {
135+ resp .Header .Set ("Content-Type" , "application/json;as=APIGroupDiscoveryList;v=v2;g=apidiscovery.k8s.io" )
136+ } else {
137+ resp .Header .Set ("Content-Type" , "application/json" )
138+ }
133139 }
134140
135141 return resp , nil
@@ -152,6 +158,9 @@ func isServerGroupResourceDiscovery(path string) bool {
152158 if path == "/api" {
153159 return true
154160 }
161+ if path == "/apis" {
162+ return true
163+ }
155164
156165 parts := strings .Split (path , "/" )
157166 if len (parts ) != 4 {
0 commit comments