diff --git a/src/main/resources/swagger/api-docs.yaml b/src/main/resources/swagger/api-docs.yaml index 3f60bd5e0..33cf4f925 100755 --- a/src/main/resources/swagger/api-docs.yaml +++ b/src/main/resources/swagger/api-docs.yaml @@ -3308,7 +3308,7 @@ paths: schema: type: string responses: - 202: + 204: description: Favorite resource added content: { } 404: @@ -3336,7 +3336,7 @@ paths: schema: type: string responses: - 202: + 204: description: Favorite resource removed content: { } /api/users/v2/{sam_user_id}: diff --git a/src/main/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2.scala b/src/main/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2.scala index d631d3aba..4b987ac3f 100644 --- a/src/main/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2.scala +++ b/src/main/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2.scala @@ -263,7 +263,7 @@ trait UserRoutesV2 extends SamUserDirectives with SamRequestContextDirectives wi requireAnyAction(resource, samUser.id, samRequestContext) { complete { resourceService.addUserFavoriteResource(samUser.id, resource, samRequestContext).map { - case true => StatusCodes.Accepted + case true => StatusCodes.NoContent case false => StatusCodes.NotFound } } @@ -274,7 +274,7 @@ trait UserRoutesV2 extends SamUserDirectives with SamRequestContextDirectives wi private def removeFavoriteResource(samUser: SamUser, resource: FullyQualifiedResourceId, samRequestContext: SamRequestContext): Route = deleteWithTelemetry(samRequestContext) { complete { - resourceService.removeUserFavoriteResource(samUser.id, resource, samRequestContext).map(_ => StatusCodes.Accepted) + resourceService.removeUserFavoriteResource(samUser.id, resource, samRequestContext).map(_ => StatusCodes.NoContent) } } } diff --git a/src/test/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2Spec.scala b/src/test/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2Spec.scala index 1a76d2521..a8821151f 100644 --- a/src/test/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2Spec.scala +++ b/src/test/scala/org/broadinstitute/dsde/workbench/sam/api/UserRoutesV2Spec.scala @@ -510,7 +510,7 @@ class UserRoutesV2Spec extends AnyFlatSpec with Matchers with TimeMatchers with // Act and Assert Put(s"/api/users/v2/self/favoriteResources/$resourceType/$resourceId") ~> samRoutes.route ~> check { - status shouldEqual StatusCodes.Accepted + status shouldEqual StatusCodes.NoContent } } @@ -585,7 +585,7 @@ class UserRoutesV2Spec extends AnyFlatSpec with Matchers with TimeMatchers with // Act and Assert Delete(s"/api/users/v2/self/favoriteResources/$resourceType/$resourceId") ~> samRoutes.route ~> check { - status shouldEqual StatusCodes.Accepted + status shouldEqual StatusCodes.NoContent } } @@ -609,7 +609,7 @@ class UserRoutesV2Spec extends AnyFlatSpec with Matchers with TimeMatchers with // Act and Assert Delete(s"/api/users/v2/self/favoriteResources/$resourceType/$resourceId") ~> samRoutes.route ~> check { - status shouldEqual StatusCodes.Accepted + status shouldEqual StatusCodes.NoContent } } }