use of cn.taketoday.http.client.ClientHttpRequest in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method requestCustomizersAddsCustomizers.
// @Test
// // gh-17885
// void defaultHeaderWhenUsingMockRestServiceServerAddsHeader() {
// RestTemplate template = this.builder.defaultHeader("spring", "boot").build();
// MockRestServiceServer.bindTo(template).build();
// ClientHttpRequest request = createRequest(template);
// assertThat(request.getHeaders()).contains(entry("spring", Collections.singletonList("boot")));
// }
@Test
void requestCustomizersAddsCustomizers() {
RestTemplate template = this.builder.requestCustomizers((request) -> request.getHeaders().add("spring", "framework")).build();
ClientHttpRequest request = createRequest(template);
assertThat(request.getHeaders()).contains(entry("spring", Collections.singletonList("framework")));
}
use of cn.taketoday.http.client.ClientHttpRequest in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method additionalRequestCustomizersAddsCustomizers.
@Test
void additionalRequestCustomizersAddsCustomizers() {
RestTemplate template = this.builder.requestCustomizers((request) -> request.getHeaders().add("spring", "framework")).additionalRequestCustomizers((request) -> request.getHeaders().add("for", "java")).build();
ClientHttpRequest request = createRequest(template);
assertThat(request.getHeaders()).contains(entry("spring", Collections.singletonList("framework"))).contains(entry("for", Collections.singletonList("java")));
}
use of cn.taketoday.http.client.ClientHttpRequest in project today-infrastructure by TAKETODAY.
the class AbstractRequestExpectationManager method getRequestDetails.
/**
* Return details of executed requests.
*/
protected String getRequestDetails() {
StringBuilder sb = new StringBuilder();
sb.append(this.requests.size()).append(" request(s) executed");
if (!this.requests.isEmpty()) {
sb.append(":\n");
for (ClientHttpRequest request : this.requests) {
sb.append(request.toString()).append('\n');
}
} else {
sb.append(".\n");
}
return sb.toString();
}
use of cn.taketoday.http.client.ClientHttpRequest in project today-framework by TAKETODAY.
the class RestTemplateBuilderTests method additionalRequestCustomizersAddsCustomizers.
@Test
void additionalRequestCustomizersAddsCustomizers() {
RestTemplate template = this.builder.requestCustomizers((request) -> request.getHeaders().add("spring", "framework")).additionalRequestCustomizers((request) -> request.getHeaders().add("for", "java")).build();
ClientHttpRequest request = createRequest(template);
assertThat(request.getHeaders()).contains(entry("spring", Collections.singletonList("framework"))).contains(entry("for", Collections.singletonList("java")));
}
use of cn.taketoday.http.client.ClientHttpRequest in project today-framework by TAKETODAY.
the class RestTemplateBuilderTests method requestCustomizersAddsCustomizers.
// @Test
// // gh-17885
// void defaultHeaderWhenUsingMockRestServiceServerAddsHeader() {
// RestTemplate template = this.builder.defaultHeader("spring", "boot").build();
// MockRestServiceServer.bindTo(template).build();
// ClientHttpRequest request = createRequest(template);
// assertThat(request.getHeaders()).contains(entry("spring", Collections.singletonList("boot")));
// }
@Test
void requestCustomizersAddsCustomizers() {
RestTemplate template = this.builder.requestCustomizers((request) -> request.getHeaders().add("spring", "framework")).build();
ClientHttpRequest request = createRequest(template);
assertThat(request.getHeaders()).contains(entry("spring", Collections.singletonList("framework")));
}
Aggregations