Commit dbef27ac by Spencer Gibb

more RibbonClient tests

parent bd808a76
......@@ -86,6 +86,14 @@ public class RibbonClientHttpRequestFactoryTests {
}
@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");
assertEquals("wrong response code", HttpStatus.OK, response.getStatusCode());
......@@ -100,6 +108,13 @@ public class RibbonClientHttpRequestFactoryTests {
}
@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() {
RequestEntity<Void> entity = RequestEntity.get(new URI("http://simple/header"))
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment