Prepare for content-type negotiation
Combine the fields that will be used for content transformation (content-type, codec, and group version) into a single struct in client, and then pass that struct into the rest client and request. Set the content-type when sending requests to the server, and accept the content type as primary. Will form the foundation for content-negotiation via the client.
This commit is contained in:
@@ -76,15 +76,15 @@ func (c *Client) Setup(t *testing.T) *Client {
|
||||
c.server = httptest.NewServer(c.handler)
|
||||
if c.Client == nil {
|
||||
c.Client = client.NewOrDie(&client.Config{
|
||||
Host: c.server.URL,
|
||||
GroupVersion: testapi.Default.GroupVersion(),
|
||||
Host: c.server.URL,
|
||||
ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()},
|
||||
})
|
||||
|
||||
// TODO: caesarxuchao: hacky way to specify version of Experimental client.
|
||||
// We will fix this by supporting multiple group versions in Config
|
||||
c.ExtensionsClient = client.NewExtensionsOrDie(&client.Config{
|
||||
Host: c.server.URL,
|
||||
GroupVersion: testapi.Extensions.GroupVersion(),
|
||||
Host: c.server.URL,
|
||||
ContentConfig: client.ContentConfig{GroupVersion: testapi.Extensions.GroupVersion()},
|
||||
})
|
||||
}
|
||||
c.QueryValidator = map[string]func(string, string) bool{}
|
||||
|
Reference in New Issue
Block a user