Skip to content

Commit 6482700

Browse files
committed
fix: BadRequest instead of InvalidParameter for create shared drive endpoint
1 parent 8e9f8e5 commit 6482700

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

web/sharings/drives.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ func CreateSharedDrive(c echo.Context) error {
7474
}
7575

7676
if attrs.FolderID == "" && attrs.Name == "" {
77-
return jsonapi.InvalidParameter("folder_id", errors.New("folder_id or name is required"))
77+
return jsonapi.BadRequest(errors.New("folder_id or name is required"))
7878
}
7979
if attrs.FolderID != "" && attrs.Name != "" {
80-
return jsonapi.InvalidParameter("folder_id", errors.New("folder_id and name are mutually exclusive"))
80+
return jsonapi.BadRequest(errors.New("folder_id and name are mutually exclusive"))
8181
}
8282

8383
if attrs.Name != "" {

web/sharings/drives_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ func TestCreateDriveFromFolder(t *testing.T) {
866866
}
867867
}
868868
}`, consts.Sharings))).
869-
Expect().Status(422)
869+
Expect().Status(400)
870870

871871
resp.JSON(httpexpect.ContentOpts{MediaType: "application/vnd.api+json"}).
872872
Object().Path("$.errors[0].detail").String().
@@ -888,7 +888,7 @@ func TestCreateDriveFromFolder(t *testing.T) {
888888
}
889889
}
890890
}`, consts.Sharings, dirID))).
891-
Expect().Status(422)
891+
Expect().Status(400)
892892

893893
resp.JSON(httpexpect.ContentOpts{MediaType: "application/vnd.api+json"}).
894894
Object().Path("$.errors[0].detail").String().

0 commit comments

Comments
 (0)