Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

extension for including ETag in responses #557

Closed
wants to merge 2 commits into from

Conversation

prabirshrestha
Copy link
Contributor

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
Copy link
Member

Will probably roll this into #183

@grumpydev grumpydev closed this Feb 16, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants