Câu hỏi phỏng vấn API Design
Câu hỏi

What are the core components of a HTTP response?

Câu trả lời

The core components of an HTTP response are:

  1. Status Line: This is the first line of the HTTP response and contains three key elements:

    • HTTP Version: Indicates the HTTP protocol version used, such as HTTP/1.1.
    • Status Code: A three-digit code that indicates the result of the HTTP request. Common status codes include 200 (OK), 404 (Not Found), and 500 (Internal Server Error).
    • Reason-Phrase: A brief textual description of the status code, such as "OK" for 200 or "Not Found" for 404[1][2][3].
  2. Headers: These provide additional information about the response. Headers are key-value pairs separated by a colon and can include:

    • Content-Type: Specifies the media type of the response body, such as text/html or application/json.
    • Content-Length: Indicates the size of the response body in bytes.
    • Date: The date and time at which the response was generated.
    • Server: Information about the server that generated the response.
    • Set-Cookie: Used to se...
middle

middle

Gợi ý câu hỏi phỏng vấn

junior

What are the advantages of Web Services?

senior

API Design có nên hỗ trợ batching không? Khi nào nên batch multiple requests?

middle

Khi thiết kế API trả về danh sách, bạn thường thêm những metadata nào vào response?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào