diff options
author | Brent Baude <bbaude@redhat.com> | 2020-01-29 11:23:03 -0600 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-01-29 12:41:39 -0600 |
commit | a8b4e986f774da48a74d84e29fb31069bb13f43a (patch) | |
tree | 89059b0f3da74c23443984eeb7767bb99e3ba9fa /pkg/bindings/connection.go | |
parent | 66bb873390badc4ad88620d211de09b4668d1cd5 (diff) | |
download | podman-a8b4e986f774da48a74d84e29fb31069bb13f43a.tar.gz podman-a8b4e986f774da48a74d84e29fb31069bb13f43a.tar.bz2 podman-a8b4e986f774da48a74d84e29fb31069bb13f43a.zip |
apiv2 binding test fixes
a recent refactor in the bindings broke the tests. quick fixes to get them working again.
Signed-off-by: Brent Baude <bbaude@redhat.com>
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 |