Merge branch '2.1.x'
This commit is contained in:
@@ -462,7 +462,7 @@ public class ProxyExchange<T> {
|
||||
|
||||
protected static class BodyGrabber {
|
||||
|
||||
public Object body(@RequestBody Object body) {
|
||||
public Object body(@RequestBody(required = false) Object body) {
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,12 @@ public class ProductionConfigurationTests {
|
||||
.isEqualTo("host=localhost;foobar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noBody() throws Exception {
|
||||
Foo foo = rest.postForObject("/proxy/no-body", null, Foo.class);
|
||||
assertThat(foo.getName()).isEqualTo("hello");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "Duplicates", "unchecked" })
|
||||
public void headers() throws Exception {
|
||||
@@ -351,6 +357,12 @@ public class ProductionConfigurationTests {
|
||||
.body(response.getBody().iterator().next()));
|
||||
}
|
||||
|
||||
@PostMapping("/proxy/no-body")
|
||||
public ResponseEntity<Foo> noBody(ProxyExchange<Foo> proxy) throws Exception {
|
||||
return proxy.uri(home.toString() + "/foos")
|
||||
.post();
|
||||
}
|
||||
|
||||
@GetMapping("/forward/**")
|
||||
public void forward(ProxyExchange<?> proxy) throws Exception {
|
||||
String path = proxy.path("/forward");
|
||||
@@ -413,6 +425,11 @@ public class ProductionConfigurationTests {
|
||||
return Arrays.asList(new Foo("hello"));
|
||||
}
|
||||
|
||||
@PostMapping("/foos")
|
||||
public Foo postFoos() {
|
||||
return new Foo("hello");
|
||||
}
|
||||
|
||||
@GetMapping("/foos/{id}")
|
||||
public Foo foo(@PathVariable Integer id, @RequestHeader HttpHeaders headers) {
|
||||
String custom = headers.getFirst("X-Custom");
|
||||
|
||||
Reference in New Issue
Block a user