Reputation: 97
So basically I want to understand the working of ETag token value in If-None-Match header in the request.
I have understood the working of If-modifies-since conditional GET method. Can someone explain in simple terms how Conditional GET work in the case of an Etag with If-None-Match condition?
Thanks in advance :)
Upvotes: 1
Views: 720
Reputation: 35885
For doing conditional requests you use If-None-Match
passing an Etag or If-Modified-Since
using a date.
A Etag is a value that represents the state of an entity. Usually, it is a base64encoded hash. The server may attach an Etag
HTTP header to the response when requesting a resource, such Etag would represent the state of the resource. Then the client may send an Etag or collection of Etags in the If-None-Match
header in next requests, so the server will check if the state of the requested resource has changed, and if so it will return HTTP 200 with the new resource representation or otherwise a HTTP 304 indicating that the resource did not change.
An Etag is considered a strong validator, so If-None-Match
will take preference over If-Modified-Since
.
More info:
Upvotes: 1