Backend2 Understanding the Real Nature of HTTP Requests: A Look Beneath High-Level Clients The HTTP clients we commonly use—such as RestTemplate, fetch, and axios—let us send requests with very simple, high-level calls. Because of this convenience, we rarely get to see what actually happens underneath. By looking at a lower-level API like HttpURLConnection, we can clearly understand how an HTTP request is constructed and transmitted. 1. Example of a Low-Level HTTP RequestBelow is a si.. 2025. 12. 9. HTTP 통신의 실제 모습 – 라이브러리가 감추고 있던 바이트 스트림 처리 우리가 사용하는 RestTemplate, fetch, axios 같은 HTTP 클라이언트는 단순 호출만으로 요청을 보낼 수 있게 해 주기 때문에 내부에서 어떤 일이 일어나는지 알기 어렵습니다. 하지만 저수준 API인 HttpURLConnection을 직접 보면 HTTP 요청이 어떤 방식으로 구성되고 전송되는지 조금 더 명확하게 이해할 수 있습니다. 1. 저수준 HTTP 요청 코드 예시아래는 JSON 데이터를 POST로 보내고, 응답을 문자열로 읽어오는 간단한 예시 코드입니다.public static String sendJsonPost(String targetUrl, String jsonBody) throws IOException { URL url = new URL(targetUrl); Http.. 2025. 12. 9. 이전 1 다음