Reputation: 12241
I'm creating a bit of a helper class in my Web API project so I'm kind of stuck using HttpRequestMessage and HttpResponseMessage, or at least so it would seem. I've generated the eTag that I want to send back in the HttpResponseMessage, but I'm not sure where to add it to the object as everything has changed since WCF where I would simply use CheckConditionalRetrieve();
My question is, I have my eTag... lol... where do I put it using HttpResponseMessage???
TIA
Upvotes: 2
Views: 2107
Reputation: 12241
I feel kinda silly. I've been looking for hours and just ran across it randomly. There are two Headers fields available in the request and response objects.
response.Headers
and
request.Content.Headers
The Etag property is in the top level Headers:
response.Headers.ETag
so my final code ended up being:
_response.Headers.ETag = new EntityTagHeaderValue(eTag);
Upvotes: 5