Skip to content

Commit

Permalink
Merge pull request geektime-geekbang#29 from digitalsonic/master
Browse files Browse the repository at this point in the history
修复提交items的问题
  • Loading branch information
geektime-geekbang authored Jul 4, 2019
2 parents ba84222 + 9a434bf commit 99c4813
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.springframework.web.client.RestTemplate;

import java.net.URI;
import java.util.Collections;

@Component
@Slf4j
Expand Down Expand Up @@ -85,7 +86,7 @@ private void addOrder(Link link, Resource<Coffee> coffee) {

Resource<CoffeeOrder> 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<String> itemResp = restTemplate.exchange(req, String.class);
log.info("add Order Items Response: {}", itemResp);
}
Expand Down

0 comments on commit 99c4813

Please sign in to comment.