Don't attempt to parse JSON payload if it is 0 bytes long.
Also added a test to trigger this.
This commit is contained in:
1 parent
6e04ccf677
commit
66c92fe075
2 files changed
+6
-1
No files matched your search
@@ -15,7 +15,7 @@ func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
|
||||
|
||||
// If the client has sent some JSON which might be a HostConfig, add our
|
||||
// parameters back into it, otherwise Docker will consider them overwritten
|
||||
if containerShouldAttach(container) && r.Header.Get("Content-Type") == "application/json" {
|
||||
if containerShouldAttach(container) && r.Header.Get("Content-Type") == "application/json" && r.ContentLength > 0 {
|
||||
params := map[string]interface{}{}
|
||||
if err := unmarshalRequestBody(r, ¶ms); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user