Use 422 status when rejecting Git LFS request

This commit is contained in:
Shane Kilkelly 2020-08-05 13:00:20 +01:00
parent f7125b9159
commit 2b8f3f4de8
2 changed files with 2 additions and 2 deletions

View file

@ -37,7 +37,7 @@ public class GitLfsHandler extends AbstractHandler {
) {
Log.info(method + " <- /<project>.git/info/lfs/objects/batch");
response.setContentType("application/vnd.git-lfs+json");
response.setStatus(406);
response.setStatus(422);
response.getWriter().println("{\"message\": \"ERROR: Git LFS is not supported on Overleaf\"}");
baseRequest.setHandled(true);
}

View file

@ -989,7 +989,7 @@ public class WLGitBridgeIntegrationTest {
String urlBase = "http://127.0.0.1:" + gitBridgePort;
HttpPost gitLfsRequest = new HttpPost(urlBase+"/5f2419407929eb0026641967.git/info/lfs/objects/batch");
HttpResponse gitLfsResponse = client.execute(gitLfsRequest);
assertEquals(406, gitLfsResponse.getStatusLine().getStatusCode());
assertEquals(422, gitLfsResponse.getStatusLine().getStatusCode());
HttpEntity entity = gitLfsResponse.getEntity();
String responseString = EntityUtils.toString(entity, "UTF-8");
assertTrue(responseString.contains("Git LFS is not supported on Overleaf"));