Use HTTP 201, 204 response codes in REST API
When creating a new entity on the server respond HTTP 201 Created with the JSON representation of the entity in the body. When deleting an existing entity, respond with HTTP 204 No Content, telling the client there is no more content behind the resources that was just deleted. This is a hint that a future GET is likely to return 404 Not Found. Change-Id: Ia7b3964267fcd55b4abcc49dcd6ba4c61f61fd5d
This commit is contained in:
@@ -18,6 +18,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@@ -71,7 +72,7 @@ class DeleteReviewer implements RestModifyView<ReviewerResource, Input> {
|
||||
} finally {
|
||||
db.rollback();
|
||||
}
|
||||
return new Object();
|
||||
return Response.none();
|
||||
}
|
||||
|
||||
private Iterable<PatchSetApproval> approvals(ReviewDb db,
|
||||
|
||||
Reference in New Issue
Block a user