@@ -185,37 +185,34 @@ private class DefaultRequestBodyUriSpec implements RequestBodyUriSpec {
185185
186186 private final Map <String , Object > attributes = new LinkedHashMap <>(4 );
187187
188- @ Nullable
189- private Consumer <ClientHttpRequest > httpRequestConsumer ;
190-
191188 @ Nullable
192189 private String uriTemplate ;
193190
194191 private final String requestId ;
195192
196193 DefaultRequestBodyUriSpec (HttpMethod httpMethod ) {
197194 this .httpMethod = httpMethod ;
198- this .requestId = String .valueOf (requestIndex .incrementAndGet ());
195+ this .requestId = String .valueOf (DefaultWebTestClient . this . requestIndex .incrementAndGet ());
199196 this .headers = new HttpHeaders ();
200197 this .headers .add (WebTestClient .WEBTESTCLIENT_REQUEST_ID , this .requestId );
201198 }
202199
203200 @ Override
204201 public RequestBodySpec uri (String uriTemplate , Object ... uriVariables ) {
205202 this .uriTemplate = uriTemplate ;
206- return uri (uriBuilderFactory .expand (uriTemplate , uriVariables ));
203+ return uri (DefaultWebTestClient . this . uriBuilderFactory .expand (uriTemplate , uriVariables ));
207204 }
208205
209206 @ Override
210207 public RequestBodySpec uri (String uriTemplate , Map <String , ?> uriVariables ) {
211208 this .uriTemplate = uriTemplate ;
212- return uri (uriBuilderFactory .expand (uriTemplate , uriVariables ));
209+ return uri (DefaultWebTestClient . this . uriBuilderFactory .expand (uriTemplate , uriVariables ));
213210 }
214211
215212 @ Override
216213 public RequestBodySpec uri (Function <UriBuilder , URI > uriFunction ) {
217214 this .uriTemplate = null ;
218- return uri (uriFunction .apply (uriBuilderFactory .builder ()));
215+ return uri (uriFunction .apply (DefaultWebTestClient . this . uriBuilderFactory .builder ()));
219216 }
220217
221218 @ Override
@@ -358,45 +355,39 @@ public ResponseSpec exchange() {
358355 initRequestBuilder ().body (this .inserter ).build () :
359356 initRequestBuilder ().build ());
360357
361- ClientResponse response = exchangeFunction .exchange (request ).block (getResponseTimeout ());
358+ ClientResponse response = DefaultWebTestClient . this . exchangeFunction .exchange (request ).block (getResponseTimeout ());
362359 Assert .state (response != null , "No ClientResponse" );
363360
364- ExchangeResult result = wiretapConnector .getExchangeResult (
361+ ExchangeResult result = DefaultWebTestClient . this . wiretapConnector .getExchangeResult (
365362 this .requestId , this .uriTemplate , getResponseTimeout ());
366363
367364 return new DefaultResponseSpec (result , response ,
368365 DefaultWebTestClient .this .entityResultConsumer , getResponseTimeout ());
369366 }
370367
371368 private ClientRequest .Builder initRequestBuilder () {
372- ClientRequest . Builder builder = ClientRequest .create (this .httpMethod , initUri ())
369+ return ClientRequest .create (this .httpMethod , initUri ())
373370 .headers (headersToUse -> {
374- if (!CollectionUtils .isEmpty (defaultHeaders )) {
375- headersToUse .putAll (defaultHeaders );
371+ if (!CollectionUtils .isEmpty (DefaultWebTestClient . this . defaultHeaders )) {
372+ headersToUse .putAll (DefaultWebTestClient . this . defaultHeaders );
376373 }
377374 if (!CollectionUtils .isEmpty (this .headers )) {
378375 headersToUse .putAll (this .headers );
379376 }
380377 })
381378 .cookies (cookiesToUse -> {
382- if (!CollectionUtils .isEmpty (defaultCookies )) {
383- cookiesToUse .putAll (defaultCookies );
379+ if (!CollectionUtils .isEmpty (DefaultWebTestClient . this . defaultCookies )) {
380+ cookiesToUse .putAll (DefaultWebTestClient . this . defaultCookies );
384381 }
385382 if (!CollectionUtils .isEmpty (this .cookies )) {
386383 cookiesToUse .putAll (this .cookies );
387384 }
388385 })
389386 .attributes (attributes -> attributes .putAll (this .attributes ));
390-
391- if (this .httpRequestConsumer != null ) {
392- builder .httpRequest (this .httpRequestConsumer );
393- }
394-
395- return builder ;
396387 }
397388
398389 private URI initUri () {
399- return (this .uri != null ? this .uri : uriBuilderFactory .expand ("" ));
390+ return (this .uri != null ? this .uri : DefaultWebTestClient . this . uriBuilderFactory .expand ("" ));
400391 }
401392
402393 }
@@ -520,9 +511,7 @@ public ResponseSpec expectAll(ResponseSpecConsumer... consumers) {
520511 // that is not a RuntimeException, but since ExceptionCollector may
521512 // throw a checked Exception, we handle this to appease the compiler
522513 // and in case someone uses a "sneaky throws" technique.
523- AssertionError assertionError = new AssertionError (ex .getMessage ());
524- assertionError .initCause (ex );
525- throw assertionError ;
514+ throw new AssertionError (ex .getMessage (), ex );
526515 }
527516 return this ;
528517 }
0 commit comments