Support the subresource of service proxy
This commit is contained in:
@@ -108,9 +108,9 @@ func (c *services) Watch(opts api.ListOptions) (watch.Interface, error) {
|
||||
// ProxyGet returns a response of the service by calling it through the proxy.
|
||||
func (c *services) ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper {
|
||||
request := c.r.Get().
|
||||
Prefix("proxy").
|
||||
Namespace(c.ns).
|
||||
Resource("services").
|
||||
SubResource("proxy").
|
||||
Name(net.JoinSchemeNamePort(scheme, name, port)).
|
||||
Suffix(path)
|
||||
for k, v := range params {
|
||||
|
@@ -218,7 +218,7 @@ func TestServiceProxyGet(t *testing.T) {
|
||||
c := &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "GET",
|
||||
Path: testapi.Default.ResourcePathWithPrefix("proxy", "services", ns, "service-1") + "/foo",
|
||||
Path: testapi.Default.ResourcePath("services", ns, "service-1") + "/proxy/foo",
|
||||
Query: simple.BuildQueryValues(url.Values{"param-name": []string{"param-value"}}),
|
||||
},
|
||||
Response: simple.Response{StatusCode: 200, RawBody: &body},
|
||||
@@ -231,7 +231,7 @@ func TestServiceProxyGet(t *testing.T) {
|
||||
c = &simple.Client{
|
||||
Request: simple.Request{
|
||||
Method: "GET",
|
||||
Path: testapi.Default.ResourcePathWithPrefix("proxy", "services", ns, "https:service-1:my-port") + "/foo",
|
||||
Path: testapi.Default.ResourcePath("services", ns, "https:service-1:my-port") + "/proxy/foo",
|
||||
Query: simple.BuildQueryValues(url.Values{"param-name": []string{"param-value"}}),
|
||||
},
|
||||
Response: simple.Response{StatusCode: 200, RawBody: &body},
|
||||
|
Reference in New Issue
Block a user