Test your knowledge of HTTP and REST basics with questions on status codes, headers, caching mechanisms like ETag, CORS, and request timing using the Network panel. Perfect for beginners who want to grasp essential web communication concepts and troubleshooting skills.
Which HTTP status code indicates that a GET request has completed successfully and the resource is returned as expected?
Explanation: The status code 200 OK means the request succeeded, and the server returned the requested resource. A 404 Not Found code means the resource was not found. 500 Error is a server error, and 301 Moved Permanently indicates the resource has moved to a new URL. Only 200 OK denotes a normal, successful retrieval.
In an HTTP response, what is the main purpose of headers such as 'Content-Type' and 'Cache-Control'?
Explanation: Response headers like 'Content-Type' and 'Cache-Control' supply metadata about how the body should be handled. They don’t encrypt or compress the response themselves, though they can indicate such features. Storing cookies uses the 'Set-Cookie' header, which is separate from those mentioned.
When you see a 404 status code in the Network panel after requesting a URL, what does it indicate about the request?
Explanation: A 404 status code means the requested URL doesn't exist on the server. Authentication required corresponds to codes like 401. Timeout errors appear with codes like 504. 200 or 201 statuses would indicate data was sent or received successfully.
What is the main role of the 'ETag' HTTP response header in web caching?
Explanation: ETag helps identify the unique version of a resource and plays a critical role in conditional caching. It doesn’t define encoding (which is handled by Content-Encoding), accepted languages (Accept-Language), or manage cookies (Set-Cookie). ETag specifically helps optimize cache validation.
In the context of CORS, which HTTP method triggers a preflight request observed in the Network panel?
Explanation: The OPTIONS method is used for CORS preflight requests, allowing the browser to determine if the actual request is safe. POST, GET, and PUT are standard methods for sending data but do not initiate preflight checks by themselves. Only OPTIONS is used for this special purpose.
In the Network panel, what does the 'Time' column typically indicate for a completed HTTP request?
Explanation: The 'Time' column shows how long the request took from start to finish. It doesn’t indicate time zones or the server's local time, nor does it reflect server load. Its purpose is to highlight network timing details for performance analysis.
Which HTTP response header is crucial for allowing cross-origin requests in CORS?
Explanation: Access-Control-Allow-Origin is essential for controlling cross-origin resource sharing. Cache-Control manages caching behavior, Content-Encoding specifies how the response is encoded, and Set-Cookie relates to client-side cookie storage. Only Access-Control-Allow-Origin is tied directly to CORS.
What does a 304 Not Modified status code mean when a browser receives it after making a request with an 'If-None-Match' header?
Explanation: A 304 Not Modified tells the browser that the previously cached resource is still valid. Forbidden access returns a 403 code, syntax errors yield a 400 code, and successful creation is indicated by 201 Created. Only 304 signals effective caching and no need to download again.
In the Network panel, what distinguishes an HTTP POST request from a GET request?
Explanation: POST methods typically send data in the request body and may modify server-side data. POST requests can and often do use headers. GET is visible in the Network panel, and POST does not always result in errors—it is a normal method for sending data.
If a server responds with 'Content-Type: application/json', what does this convey to the client?
Explanation: The Content-Type header tells clients the nature of the data in the response, in this case, JSON. It does not indicate encryption or caching. Also, JSON can contain both textual and numerical data, not just plain text.
What does an HTTP 403 status code indicate when seen in the Network panel?
Explanation: A 403 code means the server knows what you’re asking but denies permission, typically due to security policies. A missing resource would be a 404 code. Timeout gives a 504 code, and too many requests would be a 429 code. 403 is specifically about forbidden access.
What does the 'Cache-Control: no-cache' directive instruct the browser to do with the response?
Explanation: The no-cache value means the browser must confirm with the server before using a cached copy. It doesn’t block access, compress the response, or affect cross-origin requests. Only cache revalidation is affected by this header.
Which part of the Network panel helps developers evaluate how long it takes for a resource to be downloaded after the server starts sending data?
Explanation: Content Download time specifically shows how long it takes to download the actual content, post-server response. Request Method denotes the HTTP verb, Status Code is about HTTP result, and Response Header describes metadata. Only Content Download time measures this aspect of performance.
What is the primary role of the HTTP OPTIONS method as visible in network debugging tools?
Explanation: OPTIONS is designed to list which HTTP methods are permitted by a server for a given resource. Uploading is handled by POST or PUT, deleting by DELETE, and caching is managed by headers rather than methods. OPTIONS is for method discovery and validation.
If a web page’s request is blocked due to CORS, which message do you typically see in the Network panel?
Explanation: A failure to find the Access-Control-Allow-Origin header leads to CORS-related errors, often displaying a message about CORS policy. Other errors like SSL or 404 are unrelated, and 'Resource modified locally' is not a standard message for CORS issues.
When inspecting a request in the Network panel, under which category would you find 'User-Agent', 'Accept', and 'Authorization'?
Explanation: These headers are all sent by the client as part of the request. Response Headers are sent by the server. Status Codes represent server responses. Cookies may be listed separately, but these specific fields are part of Request Headers.