caelum/restfulie

304 Not Modified tries to respond with View

Closed this issue · 1 comments

I'm not sure if this is some kind of compound issue as I couldn't seem to reproduce this directly in the sample Web.csproj on restfulie.

I'm having an issue where I respond to a regular browser request after checking the Request.Headers["If-Modified-Since"] with a new NotModified() restfulie result. Instead of it returning to the browser immediately, it actually tries to respond with the view which then blows up spectacularly because the model is null.

As a temporary work around I had to create this class:

public class ReallyNotModified : ActionResult
{
    public override void ExecuteResult(ControllerContext context)
    {
        var response = context.HttpContext.Response;
        response.StatusCode = 304;
        response.StatusDescription = "Not Modified";

        new EmptyResult().ExecuteResult(context);
    }
}

And respond with this instead of the restfulie result.

Think I submitted this to the wrong Restfulie as this is for .NET