This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch feature/SLING-13414-non-html-error-responses
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git


The following commit(s) were added to 
refs/heads/feature/SLING-13414-non-html-error-responses by this push:
     new 15a27bd  SLING-13414 : DefaultErrorHandler: better support non-HTML 
requests
15a27bd is described below

commit 15a27bd13047cd1ee461f81b7aa6cf222c169820
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Wed Nov 11 10:09:08 2026 +0100

    SLING-13414 : DefaultErrorHandler: better support non-HTML requests
    
    Co-authored-by: Copilot <[email protected]>
---
 .../org/apache/sling/engine/impl/SlingRequestProcessorImplTest.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/src/test/java/org/apache/sling/engine/impl/SlingRequestProcessorImplTest.java 
b/src/test/java/org/apache/sling/engine/impl/SlingRequestProcessorImplTest.java
index 8f38a40..96a6854 100644
--- 
a/src/test/java/org/apache/sling/engine/impl/SlingRequestProcessorImplTest.java
+++ 
b/src/test/java/org/apache/sling/engine/impl/SlingRequestProcessorImplTest.java
@@ -90,6 +90,8 @@ public class SlingRequestProcessorImplTest {
 
     @Test
     public void testHandleErrorWithNullMessageStillSetsStatus() throws 
Exception {
+        when(request.getHeader("Accept")).thenReturn("text/html");
+
         processor.handleError(SC_BAD_REQUEST, null, request, response);
 
         verify(response).setStatus(SC_BAD_REQUEST);
@@ -153,6 +155,7 @@ public class SlingRequestProcessorImplTest {
         when(httpServletRequest.getContextPath()).thenReturn("");
         when(httpServletRequest.getServletPath()).thenReturn("");
         when(httpServletRequest.getMethod()).thenReturn("GET");
+        when(httpServletRequest.getHeader("Accept")).thenReturn("text/html");
 
         final HttpServletResponse httpServletResponse = 
mock(HttpServletResponse.class);
         final StringWriter writer = new StringWriter();

Reply via email to