Allow variadic url values for BuildBlobUploadURL

URL values may be required to complete an upload in a single POST request,
which may include digest and size. This is not implemented in the server side,
yet, but is part of the HTTP API specification.
This commit is contained in:
Stephen J Day 2014-12-12 13:55:14 -08:00
parent d08f0edcf1
commit bb300231d0

View file

@ -101,7 +101,7 @@ func (ub *URLBuilder) BuildBlobURL(name string, dgst digest.Digest) (string, err
// BuildBlobUploadURL constructs a url to begin a blob upload in the // BuildBlobUploadURL constructs a url to begin a blob upload in the
// repository identified by name. // repository identified by name.
func (ub *URLBuilder) BuildBlobUploadURL(name string) (string, error) { func (ub *URLBuilder) BuildBlobUploadURL(name string, values ...url.Values) (string, error) {
route := ub.cloneRoute(RouteNameBlobUpload) route := ub.cloneRoute(RouteNameBlobUpload)
uploadURL, err := route.URL("name", name) uploadURL, err := route.URL("name", name)
@ -109,7 +109,7 @@ func (ub *URLBuilder) BuildBlobUploadURL(name string) (string, error) {
return "", err return "", err
} }
return uploadURL.String(), nil return appendValuesURL(uploadURL, values...).String(), nil
} }
// BuildBlobUploadChunkURL constructs a url for the upload identified by uuid, // BuildBlobUploadChunkURL constructs a url for the upload identified by uuid,