diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java index 0045649fc8..b69dbbf182 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java @@ -317,15 +317,16 @@ public class RestApiServlet extends HttpServlet { return; } - if (viewData.view instanceof RestModifyView) { + if (viewData.view instanceof RestReadView + && "GET".equals(req.getMethod())) { + result = ((RestReadView) viewData.view).apply(rsrc); + } else if (viewData.view instanceof RestModifyView) { @SuppressWarnings("unchecked") RestModifyView m = (RestModifyView) viewData.view; inputRequestBody = parseRequest(req, inputType(m)); result = m.apply(rsrc, inputRequestBody); - } else if (viewData.view instanceof RestReadView) { - result = ((RestReadView) viewData.view).apply(rsrc); } else { throw new ResourceNotFoundException(); }