Skip to content

Commit

Permalink
Use empty request if nothing was sent for migrate status
Browse files Browse the repository at this point in the history
Signed-off-by: Dinesh Israni <[email protected]>
  • Loading branch information
disrani-px committed Dec 6, 2018
1 parent 2c6c575 commit 24fc8fc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/server/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ func (vd *volAPI) cloudMigrateStatus(w http.ResponseWriter, r *http.Request) {
return
}

if err := json.NewDecoder(r.Body).Decode(statusReq); err != nil {
vd.sendError(vd.name, method, w, err.Error(), http.StatusBadRequest)
return
// Use empty request if nothing was sent
if r.ContentLength != 0 {
if err := json.NewDecoder(r.Body).Decode(statusReq); err != nil {
vd.sendError(vd.name, method, w, err.Error(), http.StatusBadRequest)
return
}
}

statusResp, err := d.CloudMigrateStatus(statusReq)
Expand Down

0 comments on commit 24fc8fc

Please sign in to comment.