Merge pull request #29 from digitalsonic/master

修复提交items的问题
master
geektime-geekbang 5 years ago committed by GitHub
commit 99c481307e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.net.URI; import java.net.URI;
import java.util.Collections;
@Component @Component
@Slf4j @Slf4j
@ -85,7 +86,7 @@ public class CustomerRunner implements ApplicationRunner {
Resource<CoffeeOrder> order = resp.getBody(); Resource<CoffeeOrder> order = resp.getBody();
Link items = order.getLink("items"); 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); ResponseEntity<String> itemResp = restTemplate.exchange(req, String.class);
log.info("add Order Items Response: {}", itemResp); log.info("add Order Items Response: {}", itemResp);
} }

Loading…
Cancel
Save