|
|
|
@ -85,6 +85,14 @@ public class RibbonClientHttpRequestFactoryTests {
@@ -85,6 +85,14 @@ public class RibbonClientHttpRequestFactoryTests {
|
|
|
|
|
assertEquals("wrong response body", "hello world", response.getBody()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void requestWithEncodedPathParamWorks() { |
|
|
|
|
ResponseEntity<String> response = restTemplate.getForEntity("http://simple/path/{param}", |
|
|
|
|
String.class, "world & everyone else"); |
|
|
|
|
assertEquals("wrong response code", HttpStatus.OK, response.getStatusCode()); |
|
|
|
|
assertEquals("wrong response body", "hello world & everyone else", response.getBody()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void requestWithRequestParamWorks() { |
|
|
|
|
ResponseEntity<String> response = restTemplate.getForEntity("http://simple/request?param={param}", String.class, "world"); |
|
|
|
@ -99,6 +107,13 @@ public class RibbonClientHttpRequestFactoryTests {
@@ -99,6 +107,13 @@ public class RibbonClientHttpRequestFactoryTests {
|
|
|
|
|
assertEquals("wrong response body", "hello world", response.getBody()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void requestWithEmptyPostWorks() { |
|
|
|
|
ResponseEntity<String> response = restTemplate.postForEntity("http://simple/emptypost", "", String.class); |
|
|
|
|
assertEquals("wrong response code", HttpStatus.OK, response.getStatusCode()); |
|
|
|
|
assertEquals("wrong response body", "hello empty", response.getBody()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
@SneakyThrows |
|
|
|
|
public void requestWithHeaderWorks() { |
|
|
|
@ -136,6 +151,11 @@ public class RibbonClientHttpRequestFactoryTests {
@@ -136,6 +151,11 @@ public class RibbonClientHttpRequestFactoryTests {
|
|
|
|
|
return "hello "+param; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/emptypost", method = RequestMethod.POST) |
|
|
|
|
public String hiPostEmpty() { |
|
|
|
|
return "hello empty"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping("/header") |
|
|
|
|
public String hiHeader(@RequestHeader("X-Param") String param) { |
|
|
|
|
return "hello "+param; |
|
|
|
|