Return Bad Request on bad reviewers to PostReview
Now that posting a review can be used to add reviewers, it's possible for the entire post to fail due to bad input (e.g., an unresolvable account, an oversized group). This information is already returned in the JSON response body, but we should use a status code other than 200 OK when this happens so the client doesn't erroneously assume that the review was successfully posted. Change-Id: I763b5c73878b7c70a95953759b371a182c8a8dad
This commit is contained in:

committed by
David Pursehouse

parent
b86c905fd6
commit
e2aacef35c
@@ -52,6 +52,11 @@ public abstract class Response<T> {
|
||||
return new Redirect(location);
|
||||
}
|
||||
|
||||
/** Arbitrary status code with wrapped result. */
|
||||
public static <T> Response<T> withStatusCode(int statusCode, T value) {
|
||||
return new Impl<>(statusCode, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static <T> T unwrap(T obj) {
|
||||
while (obj instanceof Response) {
|
||||
|
Reference in New Issue
Block a user