extension for including ETag in responses #557

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@prabirshrestha

Adds ETag header if it does not exist. If it already exists, it does not modify the existing ETag header value.

using Nancy.Caching;

public SampleModule()
{
    this.IncludeETag();
    Get["/"] = x => Response.AsJson(new { name = "Nancy" });
}

ETag value is generated using the md5 hash of the response body.

Pull request for #183

It is meant to go with pull request #547 (Conditional e-tags).

public SampleModule()
{
    this.CheckForIfNonMatch();
    this.IncludeETag();
    Get["/"] = x => Response.AsJson(new { name = "Nancy" });
}

This sample would return 304 not modified without the body if etag matches and will also always include the ETag header in the response.
@gissues:{"order":66.66666666666666,"status":"backlog"}

@grumpydev
Custodians of the Super-Duper-Happy-Path member

Will probably roll this into #183

@grumpydev grumpydev closed this Feb 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment