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

middle

Khi thiết kế API tạo nhiều bản ghi cùng lúc (bulk create), bạn xử lý transaction như thế nào?

middle

Khi thiết kế API cho mobile client, bạn có cần tối ưu structure response không?

senior

API Design nên chấp nhận input flexible hay strict schema? Ưu nhược điểm?

Bình luận

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

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