Support the subresource of service proxy

This commit is contained in:
feihujiang
2015-11-18 11:42:03 +08:00
parent bcabc096f2
commit ac9f890238
31 changed files with 6434 additions and 4240 deletions

View File

@@ -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 {

View File

@@ -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},