Fix recent regression in WebTestClient

Closes gh-25854
This commit is contained in:
Rossen Stoyanchev 2020-10-06 17:04:31 +01:00
parent e78aa6b8f8
commit 30c7940483
2 changed files with 10 additions and 2 deletions

View File

@ -213,7 +213,6 @@ class DefaultWebTestClient implements WebTestClient {
@Override
public RequestBodySpec uri(URI uri) {
this.uriTemplate = null;
this.uri = uri;
return this;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -99,7 +99,16 @@ public class DefaultControllerSpecTests {
assertThat(codecsConsumer.getValue()).isNotNull();
assertThat(pathMatchingConsumer.getValue()).isNotNull();
assertThat(viewResolverConsumer.getValue()).isNotNull();
}
@Test // gh-25854
public void uriTemplate() {
new DefaultControllerSpec(new MyController()).build()
.get().uri("/")
.exchange()
.expectStatus().isOk()
.expectBody(String.class).isEqualTo("Success")
.consumeWith(result -> assertThat(result.getUriTemplate()).isEqualTo("/"));
}