@@ -158,7 +158,7 @@ public void testApplyProductSpecificResponseHeaders() {
158158 final ThreadContext threadContext = client .threadPool ().getThreadContext ();
159159 final RestController restController = new RestController (null , null , circuitBreakerService , usageService , telemetryProvider );
160160 RestRequest fakeRequest = new FakeRestRequest .Builder (xContentRegistry ()).build ();
161- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
161+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
162162 restController .dispatchRequest (fakeRequest , channel , threadContext );
163163 // the rest controller relies on the caller to stash the context, so we should expect these values here as we didn't stash the
164164 // context in this test
@@ -177,7 +177,7 @@ public void testRequestWithDisallowedMultiValuedHeader() {
177177 restHeaders .put ("header.1" , Collections .singletonList ("boo" ));
178178 restHeaders .put ("header.2" , List .of ("foo" , "bar" ));
179179 RestRequest fakeRequest = new FakeRestRequest .Builder (xContentRegistry ()).withHeaders (restHeaders ).build ();
180- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
180+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
181181 restController .dispatchRequest (fakeRequest , channel , threadContext );
182182 assertTrue (channel .getSendResponseCalled ());
183183 }
@@ -208,7 +208,7 @@ public String getName() {
208208 });
209209 }
210210 });
211- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .OK );
211+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .OK );
212212 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
213213 verify (requestsCounter ).incrementBy (
214214 eq (1L ),
@@ -232,7 +232,7 @@ public MethodHandlers next() {
232232 return null ;
233233 }
234234 });
235- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
235+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
236236 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
237237 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 400 )));
238238 }
@@ -254,7 +254,7 @@ public MethodHandlers next() {
254254 }
255255 });
256256
257- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
257+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
258258 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
259259 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 400 )));
260260 }
@@ -277,7 +277,7 @@ public String getName() {
277277 }));
278278 when (spyRestController .getAllHandlers (any (), eq (fakeRequest .rawPath ()))).thenAnswer (x -> handlers .iterator ());
279279
280- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .METHOD_NOT_ALLOWED );
280+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .METHOD_NOT_ALLOWED );
281281 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
282282 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 405 )));
283283 }
@@ -287,7 +287,7 @@ public void testDispatchBadRequestEmitsMetric() {
287287 final RestController restController = new RestController (null , null , circuitBreakerService , usageService , telemetryProvider );
288288 RestRequest fakeRequest = new FakeRestRequest .Builder (xContentRegistry ()).build ();
289289
290- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
290+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
291291 restController .dispatchBadRequest (channel , threadContext , new Exception ());
292292 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 400 )));
293293 }
@@ -311,7 +311,7 @@ public MethodHandlers next() {
311311 return new MethodHandlers ("/" ).addMethod (GET , RestApiVersion .current (), (request , channel , client ) -> {});
312312 }
313313 });
314- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
314+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
315315 restController .dispatchRequest (fakeRequest , channel , threadContext );
316316 verify (tracer ).startTrace (
317317 eq (threadContext ),
@@ -337,7 +337,7 @@ public void testRequestWithDisallowedMultiValuedHeaderButSameValues() {
337337 new RestResponse (RestStatus .OK , RestResponse .TEXT_CONTENT_TYPE , BytesArray .EMPTY )
338338 )
339339 );
340- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .OK );
340+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .OK );
341341 restController .dispatchRequest (fakeRequest , channel , threadContext );
342342 assertTrue (channel .getSendResponseCalled ());
343343 }
@@ -801,7 +801,7 @@ public void testFavicon() {
801801 final FakeRestRequest fakeRestRequest = new FakeRestRequest .Builder (NamedXContentRegistry .EMPTY ).withMethod (GET )
802802 .withPath ("/favicon.ico" )
803803 .build ();
804- final AssertingChannel channel = new AssertingChannel (fakeRestRequest , false , RestStatus .OK );
804+ final AssertingChannel channel = new AssertingChannel (fakeRestRequest , true , RestStatus .OK );
805805 restController .dispatchRequest (fakeRestRequest , channel , client .threadPool ().getThreadContext ());
806806 assertTrue (channel .getSendResponseCalled ());
807807 assertThat (channel .getRestResponse ().contentType (), containsString ("image/x-icon" ));
@@ -1085,7 +1085,7 @@ public void testApiProtectionWithServerlessDisabled() {
10851085 List <String > accessiblePaths = List .of ("/public" , "/internal" , "/hidden" );
10861086 accessiblePaths .forEach (path -> {
10871087 RestRequest request = new FakeRestRequest .Builder (xContentRegistry ()).withPath (path ).build ();
1088- AssertingChannel channel = new AssertingChannel (request , false , RestStatus .OK );
1088+ AssertingChannel channel = new AssertingChannel (request , true , RestStatus .OK );
10891089 restController .dispatchRequest (request , channel , new ThreadContext (Settings .EMPTY ));
10901090 });
10911091 }
@@ -1107,7 +1107,7 @@ public void testApiProtectionWithServerlessEnabledAsEndUser() {
11071107
11081108 final Consumer <List <String >> checkUnprotected = paths -> paths .forEach (path -> {
11091109 RestRequest request = new FakeRestRequest .Builder (xContentRegistry ()).withPath (path ).build ();
1110- AssertingChannel channel = new AssertingChannel (request , false , RestStatus .OK );
1110+ AssertingChannel channel = new AssertingChannel (request , true , RestStatus .OK );
11111111 restController .dispatchRequest (request , channel , new ThreadContext (Settings .EMPTY ));
11121112 });
11131113 final Consumer <List <String >> checkProtected = paths -> paths .forEach (path -> {
0 commit comments