Bird
0
0

A client sends a request with header If-None-Match: "xyz789". The server responds with:

medium📝 Debug Q14 of 15
Rest API - Caching Strategies
A client sends a request with header If-None-Match: "xyz789". The server responds with:
HTTP/1.1 200 OK
ETag: "abc123"
{ "data": "new content" }

What is the likely problem in this interaction?
AThe server sent a different ETag, indicating data changed, so 200 OK is correct
BThe server should respond with 304 Not Modified instead of 200 OK
CThe client sent an invalid ETag header
DThe server response is missing the If-None-Match header
Step-by-Step Solution
Solution:
  1. Step 1: Compare client and server ETags

    Client sent "xyz789", server responded with "abc123" which is different.
  2. Step 2: Understand server response code

    Since ETags differ, data changed, so server correctly sends 200 OK with new data.
  3. Final Answer:

    The server sent a different ETag, indicating data changed, so 200 OK is correct -> Option A
  4. Quick Check:

    Different ETag means data changed, send 200 OK [OK]
Quick Trick: Different ETag means new data, so 200 OK is correct [OK]
Common Mistakes:
MISTAKES
  • Expecting 304 when ETags differ
  • Thinking client ETag must match server's
  • Confusing If-None-Match with If-Match

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes