Skip to content

Commit 3c97f47

Browse files
authored
Merge pull request #4640 from adamretter/hotfix/rest-internal-server-error
Correct the response code of the REST Server when executing an invalid stored query
2 parents 89109f6 + 758acba commit 3c97f47

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

exist-core/src/main/java/org/exist/http/RESTServer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ public void doGet(final DBBroker broker, final Txn transaction, final HttpServle
537537
LOG.debug(e.getMessage(), e);
538538
}
539539
if (MimeType.XML_TYPE.getName().equals(mimeType)) {
540-
writeXPathException(response, HttpServletResponse.SC_BAD_REQUEST, encoding, query, path, e);
540+
writeXPathException(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, encoding, query, path, e);
541541
} else {
542-
writeXPathExceptionHtml(response, HttpServletResponse.SC_BAD_REQUEST, encoding, query,
542+
writeXPathExceptionHtml(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, encoding, query,
543543
path, e);
544544
}
545545
}
@@ -702,10 +702,10 @@ public void doPost(final DBBroker broker, final Txn transaction, final HttpServl
702702

703703
} catch (final XPathException e) {
704704
if (MimeType.XML_TYPE.getName().equals(mimeType)) {
705-
writeXPathException(response, HttpServletResponse.SC_BAD_REQUEST, encoding, null, path, e);
705+
writeXPathException(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, encoding, null, path, e);
706706

707707
} else {
708-
writeXPathExceptionHtml(response, HttpServletResponse.SC_BAD_REQUEST, encoding, null, path, e);
708+
writeXPathExceptionHtml(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, encoding, null, path, e);
709709
}
710710
}
711711
return;

0 commit comments

Comments
 (0)