Skip to content

Commit

Permalink
Merge pull request #50 from bbenzo/fix/portForwardPath
Browse files Browse the repository at this point in the history
fix port forward request path
  • Loading branch information
cjimti authored Mar 24, 2019
2 parents 9c01207 + 21284bd commit c9c060e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/fwdport/fwdport.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"os/signal"
"strconv"
"strings"

"github.com/prometheus/common/log"

Expand Down Expand Up @@ -63,7 +64,7 @@ func PortForward(pfo *PortForwardOpts) error {
u := url.URL{
Scheme: req.URL().Scheme,
Host: req.URL().Host,
Path: "/api/v1" + req.URL().Path,
Path: buildPath(req),
RawQuery: "timeout=32s",
}

Expand Down Expand Up @@ -143,3 +144,9 @@ func PortForward(pfo *PortForwardOpts) error {

return nil
}

func buildPath(req *restclient.Request) string {
splitted := strings.Split(req.URL().Path, "/namespaces")
path := splitted[0] + "/api/v1/namespaces" + splitted[1]
return path
}

0 comments on commit c9c060e

Please sign in to comment.