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

DefaultHttpResponse does not account for other redirect status codes #735

Closed
smarts opened this issue Nov 14, 2016 · 9 comments
Closed

DefaultHttpResponse does not account for other redirect status codes #735

smarts opened this issue Nov 14, 2016 · 9 comments
Milestone

Comments

@smarts
Copy link
Contributor

smarts commented Nov 14, 2016

Status codes 303, 307, & 308 are valid redirect codes and should be incorporated into DefaultHttpResponse. My guess is that 303 probably isn't a big deal, but the other 2 should definitely be handled.

@Tratcher
Copy link
Member

You mean the public override void Redirect(string location, bool permanent) API?
https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNetCore.Http/Internal/DefaultHttpResponse.cs#L125

Is this theoretical or do you really want to send 307/308 in your app?

@smarts
Copy link
Contributor Author

smarts commented Nov 14, 2016

Yup, that's the API. And no, it's not theoretical.

@smarts
Copy link
Contributor Author

smarts commented Nov 18, 2016

What do you think about adding bool preserveMethod as an optional parameter to the Redirect() method (defaulted to false)?

@muratg muratg added this to the Discussions milestone Nov 21, 2016
@muratg
Copy link

muratg commented Nov 21, 2016

Putting this in Discussions now. Let's see if we get more feedback on these newer status codes.

In the meantime, @smarts, you could write your own extension methods to get this functionality.

@smarts
Copy link
Contributor Author

smarts commented Nov 23, 2016

True @muratg, but what I can't do is change the existing RedirectToRouteResult to add a PreserveMethod property so that I can take advantage of this in the built-in RedirectToRoute() and RedirectToRoutePermanent() controller methods.

@Tratcher
Copy link
Member

So even if we added this here you'd also want changes to MVC.

@smarts
Copy link
Contributor Author

smarts commented Nov 24, 2016

Yes, @Tratcher. The RedirectToRouteResult (and the other redirect result classes) would presumably need to add a PreserveMethod property so that RedirectToRouteResultExecutor can propagate it down to the HttpResponse.Redirect() call.

@Tratcher
Copy link
Member

Please file another bug on MVC. That can be implemented independent of this one.

@muratg
Copy link

muratg commented May 12, 2017

We are closing this issue because no further action is planned for this issue. If you still have any issues or questions, please log a new issue with any additional details that you have.

@muratg muratg closed this as completed May 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants