Bird
0
0

Given this HTTP response header snippet:

medium📝 Predict Output Q13 of 15
Rest API - Request and Response Format
Given this HTTP response header snippet:
Cache-Control: max-age=0, must-revalidate
ETag: "abc123"

What happens when the browser sends a request with header If-None-Match: "abc123"?
AServer returns 304 Not Modified if content unchanged
BServer returns full content ignoring ETag
CServer returns 500 Internal Server Error
DServer always returns 200 OK with new ETag
Step-by-Step Solution
Solution:
  1. Step 1: Understand ETag and If-None-Match interaction

    The ETag header is a unique identifier for the content version. The browser sends If-None-Match with the ETag value to check if content changed.
  2. Step 2: Interpret Cache-Control and server response

    With max-age=0 and must-revalidate, the browser asks server to validate content. If ETag matches, server responds with 304 Not Modified, saving bandwidth.
  3. Final Answer:

    Server returns 304 Not Modified if content unchanged -> Option A
  4. Quick Check:

    ETag + If-None-Match = 304 if unchanged [OK]
Quick Trick: ETag + If-None-Match = 304 Not Modified if same [OK]
Common Mistakes:
  • Assuming server always sends full content
  • Confusing 304 with error codes
  • Ignoring Cache-Control directives

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes