//body
LinkedMultiValueMap<String,String> map=new LinkedMultiValueMap<>();
map.add("cid","TC0ONETIME");
map.add("partner_order_id",orderId);
map.add("partner_user_id",memberId);
map.add("item_name","born-shape toy");
map.add("quantity","1");
map.add("total_amount","15000");
map.add("tax_free_amount", "0");
map.add("approval_url", "http://localhost:8080/success");
map.add("cancel_url", "http://localhost:8080/cancel");
map.add("fail_url", "http://localhost:8080/fail");
//header
HttpHeaders headers=new HttpHeaders();
String auth = "SECRET_KEY " + secret_dev;
headers.set("Content-type","application/json");
headers.set("Authorization",auth);
//request
HttpEntity<MultiValueMap<String, String>> urlRequest = new HttpEntity<>(map, headers);
RestTemplate rt = new RestTemplate();
PayReadyResDto payReadyResDto = rt.postForObject("https://open-api.kakaopay.com/online/v1/payment/ready", urlRequest, PayReadyResDto.class);
spring boot test에서 위와 같이 코드 작성하고 실행했더니
400 Bad Request: “{“extras”:null,“error_message”:“invalid param(cid has invalid value)”,“error_code”:-400}”
이런 에러가 반환 되는데 이유가 뭘까요?
똑같은 body, header, host로 postman으로 request 보냈을 땐 정상적으로 반환이 되는데 저건 안되네요