Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
return 400 if request validation fails
Browse files Browse the repository at this point in the history
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
  • Loading branch information
Madhu-1 authored and prashanthpai committed Aug 7, 2018
1 parent d83253f commit d936ea8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion glusterd2/commands/snapshot/snapshot-activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func snapshotActivateHandler(w http.ResponseWriter, r *http.Request) {
var req api.SnapActivateReq
vol = &snapinfo.SnapVolinfo
if err := restutils.UnmarshalRequest(r, &req); err != nil {
restutils.SendHTTPError(ctx, w, http.StatusUnprocessableEntity, err)
restutils.SendHTTPError(ctx, w, http.StatusBadRequest, err)
return
}

Expand Down
4 changes: 2 additions & 2 deletions glusterd2/commands/snapshot/snapshot-clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func snapshotCloneHandler(w http.ResponseWriter, r *http.Request) {

snapname := mux.Vars(r)["snapname"]
if snapname == "" {
restutils.SendHTTPError(ctx, w, http.StatusUnprocessableEntity, errors.New("Snapshot name should not be empty"))
restutils.SendHTTPError(ctx, w, http.StatusBadRequest, errors.New("Snapshot name should not be empty"))
return
}

Expand All @@ -296,7 +296,7 @@ func snapshotCloneHandler(w http.ResponseWriter, r *http.Request) {
}

if !volume.IsValidName(req.CloneName) {
restutils.SendHTTPError(ctx, w, http.StatusUnprocessableEntity, gderrors.ErrInvalidVolName)
restutils.SendHTTPError(ctx, w, http.StatusBadRequest, gderrors.ErrInvalidVolName)
return
}

Expand Down
2 changes: 1 addition & 1 deletion glusterd2/commands/snapshot/snapshot-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ func snapshotCreateHandler(w http.ResponseWriter, r *http.Request) {
}

if !volume.IsValidName(req.SnapName) {
restutils.SendHTTPError(ctx, w, http.StatusUnprocessableEntity, gderrors.ErrInvalidSnapName)
restutils.SendHTTPError(ctx, w, http.StatusBadRequest, gderrors.ErrInvalidSnapName)
return
}

Expand Down

0 comments on commit d936ea8

Please sign in to comment.