Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

RedirectResult should support preservation of HTTP method #5609

Closed
smarts opened this issue Dec 8, 2016 · 4 comments
Closed

RedirectResult should support preservation of HTTP method #5609

smarts opened this issue Dec 8, 2016 · 4 comments

Comments

@smarts
Copy link

smarts commented Dec 8, 2016

Status codes 303, 307, & 308 are valid redirect codes and should be incorporated into RedirectResult and the corresponding controller methods. My guess is that 303 probably isn't a big deal, but the other 2 should definitely be handled.
Similar issue: aspnet/HttpAbstractions#735

@juunas11
Copy link
Contributor

juunas11 commented Dec 8, 2016

If we are changing RedirectResult, we should be changing RedirectToActionResult and RedirectToRouteResult as well.

Currently there is a boolean property Permanent, that specifies if a 301 or 302 is used. This would have to change so that we could specify the type e.g. with an enum. Something like:

public enum RedirectType
{
    Permanent = 301,
    Found = 302,
    SeeOther = 303,
    TemporaryMethodPreserved = 307,
    PermanentMethodPreserved = 308
}

The 307 and 308 status codes would need to be named in such a way that they will not be confused with 301 and 302.

ControllerBase redirect methods would need updates too.

@smarts
Copy link
Author

smarts commented Dec 8, 2016

@juunas11 you could do that, or you could add another Boolean value: PreserveMethod. But yes, all the redirect-focused action results need to change. 👍
If you do go the enum route, I would suggest adding Temporary = 302 as well, just so it's easier to correlate between *MethodPreserved and method-not-preserved.

@Eilon
Copy link
Member

Eilon commented Mar 6, 2017

For the methods on ControllerBase, each of the Redirect/RedirectToAction/RedirectToRoute methods should gain an additional overload, adding a new bool preserveMethod parameter (and all the current overloads can just call into that).

For the RedirectResult/RedirectToActionResult/RedirectToRouteResult types, each should gain a new ctor and matching get/set property called PreserveMethod.

jbagga added a commit that referenced this issue Apr 11, 2017
@jbagga
Copy link
Contributor

jbagga commented Apr 11, 2017

Also added PreserveMethod to LocalRedirectResult

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants