[Web] HTTP API 실습 중 마주한 No response Is the certificate valid? Click here to check. 에러 메세지
✔ 실습환경
JDK : AdoptOpenJDK 11 (LTS) 👉 https://adoptopenjdk.net/
IntelliJ : 2022.2.3 Community 👉 https://www.jetbrains.com/ko-kr/idea/download/#section=windows
API Test Tool : Talend API Tester 👉 https://chrome.google.com/webstore/detail/talend-api-tester-free-ed/aejoelaoggembcahagimdiliamlcdmfm
✔ 발생한 에러
구글 확장 프로그램인 Talend API Tester를 사용하여 HTTP 통신을 테스트하던 중에 다음과 같은 에러가 발생
에러의 내용은 다음과 같다.
No response Is the certificate valid? Click here to check.
응답이 없음. 유효한 인증서입니까? 확인하려면 이곳을 클릭하세요.
Talend API Tester가 알려준 "인증서"가 무엇을 의미하는지 몰라 다음과 같은 과정을 거친 끝에 해결할 수 있었다.
✔ 해결과정
1️⃣ Talend API Tester에 입력한 HTTP 메서드, URI, query, parameter가 일치한지 확인
package com.springboot.hello.controller;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/api/v1/post-api")
public class PostController {
@RequestMapping(value = "/domain", method = RequestMethod.POST)
public String postExample() {
return "Hello Post API";
}
@PostMapping(value = "/member")
public String postMember(@RequestBody Map<String, Object> postData) {
StringBuilder sb = new StringBuilder();
for (Map.Entry map : postData.entrySet()) {
sb.append(map.getKey() + " : " + map.getValue() + "\n");
}
System.out.println("request가 호출 완료되었습니다.");
return sb.toString();
}
}
모두 잘 입력했다고 생각했지만 새로고침을 하고 다시 돌려보니 역시나 같은 상황이 반복하였다.
2️⃣ 입력한 JSON 객체 확인
개인정보라서 가려놓았지만 마찬가지로 JSON도 잘 입력해서 보내주고 있음을 확인했다.
3️⃣ HTTP 프로토콜 확인
원인은 URI를 적을 때 `https`로 HTTP 프로토콜을 잘못 적었기 때문이었다.
위와 같이 https 👉 http로 변경 후 다시 Talend API Tester의 Send 버튼을 눌러보면 아래와 같이 HTTP Status코드가 200(성공)이 뜨게 된다.