When a service accepts different MediaTypes in th the Accept header, how does this then fit together with ETag??
Let imagine a client calling a service with the Accept header set to 'application/vnd.company.hierarchy'...
The first time the service will be called it'll return the ETag: "2012.04.19"
The next time the service is called, the IfNoneMatch header is set to "2012.04.19" and the service will return HTTP Status: NotModified
But what will happen if the second call uses a different Accept header (Assuming Vary is set to Accept)??? Will IfNoneMatch still be set to "2012.04.19" and it's up to the ETag handler, so distinct the two calls... or will the call not contain an IfNoneMatch
header??
I've been playing a little with a SilverLight application using ClientHttp, and eventhough that shouldn't implement any Caching feature, it seems like I'm getting a IfNoneMatch header in my request, just as it's able to handle a status of NotModified....
though it seems to either ignore the Vary header or just always set the IfNoneMatch no matter if the Accept header has changed...
If I'm returning a different ETag depending of the representation of my service, wouldn't I then expect the client to send a different If-Non-Match header for the same resource with different representation?
I've tried that, but the client seem to just use the same ETag for the same resource, no matter what representation I request....
smolesen
Member
43 Points
37 Posts
ETag and MediaType
Apr 19, 2012 10:45 AM|LINK
When a service accepts different MediaTypes in th the Accept header, how does this then fit together with ETag??
Let imagine a client calling a service with the Accept header set to 'application/vnd.company.hierarchy'...
The first time the service will be called it'll return the ETag: "2012.04.19"
The next time the service is called, the IfNoneMatch header is set to "2012.04.19" and the service will return HTTP Status: NotModified
But what will happen if the second call uses a different Accept header (Assuming Vary is set to Accept)??? Will IfNoneMatch still be set to "2012.04.19" and it's up to the ETag handler, so distinct the two calls... or will the call not contain an IfNoneMatch header??
I've been playing a little with a SilverLight application using ClientHttp, and eventhough that shouldn't implement any Caching feature, it seems like I'm getting a IfNoneMatch header in my request, just as it's able to handle a status of NotModified.... though it seems to either ignore the Vary header or just always set the IfNoneMatch no matter if the Accept header has changed...
Anyone who can clearify a bit??
Darrel Mille...
Member
176 Points
56 Posts
Re: ETag and MediaType
Apr 19, 2012 12:16 PM|LINK
ETags are specific to a representation, not a resource. So each different media-type has it's own ETag value.
smolesen
Member
43 Points
37 Posts
Re: ETag and MediaType
Apr 19, 2012 01:47 PM|LINK
If I'm returning a different ETag depending of the representation of my service, wouldn't I then expect the client to send a different If-Non-Match header for the same resource with different representation?
I've tried that, but the client seem to just use the same ETag for the same resource, no matter what representation I request....