lokanath das
lokanath das

Reputation: 916

Efficient way to generate a strong eTag Hash code

I am currently implementing the eTag for my GET end points. so using below process to generate & all looks good.

  1. Using ActionFilterAttribute & overriding the OnActionExecuted(ActionExecutedContext context).
  2. Using SHA256 to generate the hash.(its working for Md5 also). As SHA256 is more secure, although late in processing but that is not an issue.
  3. I can see the eTag & I am adding in to the response header.

issue:- In my GET end point, I call 100 record. so I do get a eTag in runtime & it works. Lets assume i have updated the name of a record/entity, which is a very small update. Logically it should generate a new eTag. But its not. it's giving same old eTag.

it's not the case for single record, as I am using CosmosDb, so i can use the eTag of the cosmosDb, but when I fetch a bunch of record, how to handle it?

I have come across this doc , but wanted to check if effective way of generating eTag is there?

Upvotes: 1

Views: 763

Answers (0)

Related Questions