Return NO_CONTENT when removing a ref through ApplyObject When the ApplyObject REST-API execution results in the removal of a ref, the returned status code should be a 204 (NO_CONTENT) rather than a 201 (CREATED). Change-Id: Iecc5c2d9d75b47214485d627bc718136bf508b59
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectAction.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectAction.java index 442f585..872e17a 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectAction.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/ApplyObjectAction.java
@@ -31,6 +31,7 @@ import com.googlesource.gerrit.plugins.replication.pull.api.exception.RefUpdateException; import java.io.IOException; import java.util.Objects; +import javax.servlet.http.HttpServletResponse; public class ApplyObjectAction implements RestModifyView<ProjectResource, RevisionInput> { @@ -77,7 +78,7 @@ input.getLabel(), input.getRefName(), input.getRevisionData()); - return Response.created(input); + return Response.withStatusCode(HttpServletResponse.SC_NO_CONTENT, ""); } try {