修复提交items的问题

master^2
DigitalSonic 5 years ago
parent 879eeadd89
commit 9a434bfa62

@ -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