diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-01-29 12:30:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-29 12:30:46 -0800 |
commit | 0e21fc88604fd2fc12fbbbf5d0f162081aa5dda2 (patch) | |
tree | 881bd131ca9487333959a72e27c9a9d80cbb1cfa /pkg/bindings/connection.go | |
parent | 955866c97da3007be20a6812eb8afa48e9833d23 (diff) | |
parent | a8b4e986f774da48a74d84e29fb31069bb13f43a (diff) | |
download | podman-0e21fc88604fd2fc12fbbbf5d0f162081aa5dda2.tar.gz podman-0e21fc88604fd2fc12fbbbf5d0f162081aa5dda2.tar.bz2 podman-0e21fc88604fd2fc12fbbbf5d0f162081aa5dda2.zip |
Merge pull request #5015 from baude/bindingtestfixes
apiv2 binding test fixes
Diffstat (limited to 'pkg/bindings/connection.go')
-rw-r--r-- | pkg/bindings/connection.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go index 3dec6ca20..2e5fc9cb8 100644 --- a/pkg/bindings/connection.go +++ b/pkg/bindings/connection.go @@ -115,11 +115,12 @@ func (c *Connection) DoRequest(httpBody io.Reader, httpMethod, endpoint string, ) safePathValues := make([]interface{}, len(pathValues)) // Make sure path values are http url safe - for _, pv := range pathValues { - safePathValues = append(safePathValues, url.QueryEscape(pv)) + for i, pv := range pathValues { + safePathValues[i] = url.QueryEscape(pv) } + // Lets eventually use URL for this which might lead to safer + // usage safeEndpoint := fmt.Sprintf(endpoint, safePathValues...) - e := c.makeEndpoint(safeEndpoint) req, err := http.NewRequest(httpMethod, e, httpBody) if err != nil { @@ -150,8 +151,8 @@ func GetConnectionFromContext(ctx context.Context) (*Connection, error) { if c == nil { return nil, errors.New("unable to get connection from context") } - conn := c.(Connection) - return &conn, nil + conn := c.(*Connection) + return conn, nil } // FiltersToHTML converts our typical filter format of a |