ThatRendle/Simple.Web

Discuss: change to Redirect?

Closed this issue · 4 comments

At the moment, there's the IMayRedirect interface, which adds a Location property.

As an alternative, how about an extra Location property on Status which can only be set via static methods for each of the Redirect status values.

So instead of

public class ... : IPost, IMayRedirect
{
    public Status Post()
    {
        ...
        Location = "/whatever";
        return Status.SeeOther;
    }

    public string Location { get; private set; }
}

You'd have

public class ... : IPost
{
    public Status Post()
    {
        ...
        return Status.SeeOther("/whatever");
    }
}

Unless anyone has any objections, this is going to happen.

You should be able to do this with Created status as well

Would be better IMO, as for now most of your interfaces are about requests, not about responses...

@richardhopton And Accepted, possibly, looks like that should return a URI for checking on status.

Also done.