aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-api/src/main/java/com/juick/server/api/Post.java4
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java6
2 files changed, 10 insertions, 0 deletions
diff --git a/juick-api/src/main/java/com/juick/server/api/Post.java b/juick-api/src/main/java/com/juick/server/api/Post.java
index 5757db09..d007b9af 100644
--- a/juick-api/src/main/java/com/juick/server/api/Post.java
+++ b/juick-api/src/main/java/com/juick/server/api/Post.java
@@ -93,6 +93,10 @@ public class Post {
}
}
}
+ if (StringUtils.isBlank(body) && StringUtils.isBlank(attachmentFName.toString())) {
+ // Should be there for compatibility
+ throw new HttpBadRequestException();
+ }
return commandsManager.processCommand(visitor, body, attachmentFName);
}
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index 64f92863..d719c183 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -996,4 +996,10 @@ public class ServerTests {
request, CommandResult.class);
assertThat(result.getStatusCode(), is(HttpStatus.OK));
}
+ @Test
+ public void emptyAuthenticatedPostShouldThrowBadRequest() throws Exception {
+ mockMvc.perform(post("/post")
+ .with(httpBasic(juickName, juickPassword)))
+ .andExpect(status().isBadRequest());
+ }
}