@@ -161,7 +161,7 @@ public void testApplyProductSpecificResponseHeaders() {
161161 final ThreadContext threadContext = client .threadPool ().getThreadContext ();
162162 final RestController restController = new RestController (null , null , circuitBreakerService , usageService , telemetryProvider );
163163 RestRequest fakeRequest = new FakeRestRequest .Builder (xContentRegistry ()).build ();
164- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
164+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
165165 restController .dispatchRequest (fakeRequest , channel , threadContext );
166166 // the rest controller relies on the caller to stash the context, so we should expect these values here as we didn't stash the
167167 // context in this test
@@ -180,7 +180,7 @@ public void testRequestWithDisallowedMultiValuedHeader() {
180180 restHeaders .put ("header.1" , Collections .singletonList ("boo" ));
181181 restHeaders .put ("header.2" , List .of ("foo" , "bar" ));
182182 RestRequest fakeRequest = new FakeRestRequest .Builder (xContentRegistry ()).withHeaders (restHeaders ).build ();
183- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
183+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
184184 restController .dispatchRequest (fakeRequest , channel , threadContext );
185185 assertTrue (channel .getSendResponseCalled ());
186186 }
@@ -211,7 +211,7 @@ public String getName() {
211211 });
212212 }
213213 });
214- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .OK );
214+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .OK );
215215 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
216216 verify (requestsCounter ).incrementBy (
217217 eq (1L ),
@@ -235,7 +235,7 @@ public MethodHandlers next() {
235235 return null ;
236236 }
237237 });
238- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
238+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
239239 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
240240 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 400 )));
241241 }
@@ -257,7 +257,7 @@ public MethodHandlers next() {
257257 }
258258 });
259259
260- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
260+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
261261 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
262262 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 400 )));
263263 }
@@ -280,7 +280,7 @@ public String getName() {
280280 }));
281281 when (spyRestController .getAllHandlers (any (), eq (fakeRequest .rawPath ()))).thenAnswer (x -> handlers .iterator ());
282282
283- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .METHOD_NOT_ALLOWED );
283+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .METHOD_NOT_ALLOWED );
284284 spyRestController .dispatchRequest (fakeRequest , channel , threadContext );
285285 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 405 )));
286286 }
@@ -290,7 +290,7 @@ public void testDispatchBadRequestEmitsMetric() {
290290 final RestController restController = new RestController (null , null , circuitBreakerService , usageService , telemetryProvider );
291291 RestRequest fakeRequest = new FakeRestRequest .Builder (xContentRegistry ()).build ();
292292
293- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
293+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
294294 restController .dispatchBadRequest (channel , threadContext , new Exception ());
295295 verify (requestsCounter ).incrementBy (eq (1L ), eq (Map .of (STATUS_CODE_KEY , 400 )));
296296 }
@@ -314,7 +314,7 @@ public MethodHandlers next() {
314314 return new MethodHandlers ("/" ).addMethod (GET , RestApiVersion .current (), (request , channel , client ) -> {});
315315 }
316316 });
317- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .BAD_REQUEST );
317+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .BAD_REQUEST );
318318 restController .dispatchRequest (fakeRequest , channel , threadContext );
319319 verify (tracer ).startTrace (
320320 eq (threadContext ),
@@ -340,7 +340,7 @@ public void testRequestWithDisallowedMultiValuedHeaderButSameValues() {
340340 new RestResponse (RestStatus .OK , RestResponse .TEXT_CONTENT_TYPE , BytesArray .EMPTY )
341341 )
342342 );
343- AssertingChannel channel = new AssertingChannel (fakeRequest , false , RestStatus .OK );
343+ AssertingChannel channel = new AssertingChannel (fakeRequest , true , RestStatus .OK );
344344 restController .dispatchRequest (fakeRequest , channel , threadContext );
345345 assertTrue (channel .getSendResponseCalled ());
346346 }
@@ -831,7 +831,7 @@ public void testFavicon() {
831831 final FakeRestRequest fakeRestRequest = new FakeRestRequest .Builder (NamedXContentRegistry .EMPTY ).withMethod (GET )
832832 .withPath ("/favicon.ico" )
833833 .build ();
834- final AssertingChannel channel = new AssertingChannel (fakeRestRequest , false , RestStatus .OK );
834+ final AssertingChannel channel = new AssertingChannel (fakeRestRequest , true , RestStatus .OK );
835835 restController .dispatchRequest (fakeRestRequest , channel , client .threadPool ().getThreadContext ());
836836 assertTrue (channel .getSendResponseCalled ());
837837 assertThat (channel .getRestResponse ().contentType (), containsString ("image/x-icon" ));
@@ -1115,7 +1115,7 @@ public void testApiProtectionWithServerlessDisabled() {
11151115 List <String > accessiblePaths = List .of ("/public" , "/internal" , "/hidden" );
11161116 accessiblePaths .forEach (path -> {
11171117 RestRequest request = new FakeRestRequest .Builder (xContentRegistry ()).withPath (path ).build ();
1118- AssertingChannel channel = new AssertingChannel (request , false , RestStatus .OK );
1118+ AssertingChannel channel = new AssertingChannel (request , true , RestStatus .OK );
11191119 restController .dispatchRequest (request , channel , new ThreadContext (Settings .EMPTY ));
11201120 });
11211121 }
@@ -1137,7 +1137,7 @@ public void testApiProtectionWithServerlessEnabledAsEndUser() {
11371137
11381138 final Consumer <List <String >> checkUnprotected = paths -> paths .forEach (path -> {
11391139 RestRequest request = new FakeRestRequest .Builder (xContentRegistry ()).withPath (path ).build ();
1140- AssertingChannel channel = new AssertingChannel (request , false , RestStatus .OK );
1140+ AssertingChannel channel = new AssertingChannel (request , true , RestStatus .OK );
11411141 restController .dispatchRequest (request , channel , new ThreadContext (Settings .EMPTY ));
11421142 });
11431143 final Consumer <List <String >> checkProtected = paths -> paths .forEach (path -> {
0 commit comments