Skip to content

Commit

Permalink
返回上传结果
Browse files Browse the repository at this point in the history
  • Loading branch information
kychen committed May 26, 2020
1 parent 4c0d55e commit d13aff6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions registry/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func (registry *Registry) DownloadBlob(repository string, digest digest.Digest)
return resp.Body, nil
}

func (registry *Registry) UploadBlob(repository string, digest digest.Digest, content io.Reader) error {
func (registry *Registry) UploadBlob(repository string, digest digest.Digest, content io.Reader) (*http.Response, error) {
uploadURL, err := registry.initiateUpload(repository)
if err != nil {
return err
return nil, err
}
q := uploadURL.Query()
q.Set("digest", digest.String())
Expand All @@ -34,12 +34,12 @@ func (registry *Registry) UploadBlob(repository string, digest digest.Digest, co

upload, err := http.NewRequest("PUT", uploadURL.String(), content)
if err != nil {
return err
return nil, err
}
upload.Header.Set("Content-Type", "application/octet-stream")

_, err = registry.Client.Do(upload)
return err
resp, err := registry.Client.Do(upload)
return resp, err
}

func (registry *Registry) HasBlob(repository string, digest digest.Digest) (bool, error) {
Expand Down

0 comments on commit d13aff6

Please sign in to comment.