1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add nice error message

Generally, when using Remote API to push images there needs a http Header
X-Registry-Auth.
For compatibility if there was no authConfig header, everything will be
okay if a proper JSON-http-body was applied.

But when both X-Registry-Auth Header and the Body are missing, due to
the function of decode JSON, it will return an EOF error which was not
very clear to user.

So I think we can make the respone error be more nice.

Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
Hu Keping 2015-03-27 23:17:50 +08:00
parent da5c863d20
commit cee62a95a2

View file

@ -662,7 +662,7 @@ func postImagesPush(eng *engine.Engine, version version.Version, w http.Response
} else {
// the old format is supported for compatibility if there was no authConfig header
if err := json.NewDecoder(r.Body).Decode(authConfig); err != nil {
return err
return fmt.Errorf("Bad parameters and missing X-Registry-Auth: %v", err)
}
}