더북(TheBook)

② HTTP 통신을 할 때 클라이언트가 서버로 보내는 메시지를 요청 메시지, 서버가 클라이언트로 보내는 메시지를 응답 메시지라고 합니다.

요청 메시지

POST /login HTTP/1.1         --- 요청 라인
Host: www.example.com        --- 요청 헤더
Content-Type: application/json
Content-Length: 60
                             --- 빈 라인
{                            --- 요청 본문
  "username": "qu3vipon",
  "password": "SecurePassword123!"
}

응답 메시지

HTTP/1.1 200 OK                --- 상태 라인
Content-Type: application/json --- 응답 헤더
Content-Length: 85  
                               --- 빈 라인
{                              --- 응답 본문
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6..."
}