diff --git a/Chapter 8/hateoas-customer-service/src/main/java/geektime/spring/springbucks/customer/CustomerRunner.java b/Chapter 8/hateoas-customer-service/src/main/java/geektime/spring/springbucks/customer/CustomerRunner.java index 01fcc9a..20f2608 100644 --- a/Chapter 8/hateoas-customer-service/src/main/java/geektime/spring/springbucks/customer/CustomerRunner.java +++ b/Chapter 8/hateoas-customer-service/src/main/java/geektime/spring/springbucks/customer/CustomerRunner.java @@ -21,6 +21,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import java.net.URI; +import java.util.Collections; @Component @Slf4j @@ -85,7 +86,7 @@ public class CustomerRunner implements ApplicationRunner { Resource order = resp.getBody(); Link items = order.getLink("items"); - req = RequestEntity.post(items.getTemplate().expand()).body(coffee.getLink("self")); + req = RequestEntity.post(items.getTemplate().expand()).body(Collections.singletonMap("_links", coffee.getLink("self"))); ResponseEntity itemResp = restTemplate.exchange(req, String.class); log.info("add Order Items Response: {}", itemResp); }