Merge pull request #1243 from RichardScothern/client-header-message
Add clearer messaging around missing content-length headers.
This commit is contained in:
commit
e7e0b72ae0
2 changed files with 57 additions and 0 deletions
|
@ -488,6 +488,10 @@ func (bs *blobStatter) Stat(ctx context.Context, dgst digest.Digest) (distributi
|
|||
|
||||
if SuccessStatus(resp.StatusCode) {
|
||||
lengthHeader := resp.Header.Get("Content-Length")
|
||||
if lengthHeader == "" {
|
||||
return distribution.Descriptor{}, fmt.Errorf("missing content-length header for request: %s", u)
|
||||
}
|
||||
|
||||
length, err := strconv.ParseInt(lengthHeader, 10, 64)
|
||||
if err != nil {
|
||||
return distribution.Descriptor{}, fmt.Errorf("error parsing content-length: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue