fix proxy bug (#2070)

This commit is contained in:
zryfish
2020-05-14 13:22:30 +08:00
committed by GitHub
parent d358d9ab1a
commit 1bd660c370

View File

@@ -41,6 +41,8 @@ func NewGenericProxy(endpoint string, groupName string, version string) (*generi
}, nil
}
// currently, we only support proxy GET/PUT/POST/DELETE/PATCH.
// Maybe we can try another way to implement proxy.
func (g *genericProxy) AddToContainer(container *restful.Container) error {
webservice := runtime.NewWebService(schema.GroupVersion{
Group: g.GroupName,
@@ -63,6 +65,10 @@ func (g *genericProxy) AddToContainer(container *restful.Container) error {
To(g.handler).
Returns(http.StatusOK, api.StatusOK, nil))
webservice.Route(webservice.PATCH("/{path:*}").
To(g.handler).
Returns(http.StatusOK, api.StatusOK, nil))
container.Add(webservice)
return nil