Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: When returning an Entity, the ETag header should also be set [1711]

$
0
0
When querying an OData entity like Customers(1) the ETag should appear on the payload and additionally it should appear on the ETag response header field. Not having the value on the ETag response header causes problems as the value in the payload is codified as a string and can't be used directly on the following requests without decoding it.

Current response from fiddler:
```
HTTP/1.1 200 OK
Content-Length: 159
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
OData-Version: 4.0
Date: Sun, 23 Feb 2014 02:50:48 GMT

{
"@odata.context":"http://localhost:12345/odata/$metadata#Customers/$entity","@odata.etag":"W/\"MA==\"","Id":1,"Name":"Customer 37","Age":19,"Version":0
}
```

Expected response:
```
HTTP/1.1 200 OK
Content-Length: 159
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
OData-Version: 4.0
Date: Sun, 23 Feb 2014 02:50:48 GMT
ETag: W/"MA=="

{
"@odata.context":"http://localhost:12345/odata/$metadata#Customers/$entity","@odata.etag":"W/\"MA==\"","Id":1,"Name":"Customer 37","Age":19,"Version":0
}
```
Comments: Although the ETag from the payload can be converted to an EntityTagHeaderValue using the EntityTagHeaderValue.Parse method, it's important to put this header so that intermediate proxies can properly cache and invalidate the responses as appropiate.

Viewing all articles
Browse latest Browse all 7215

Trending Articles