Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add redirect support #84

Closed
dfilipovic39 opened this issue Jul 26, 2014 · 9 comments
Closed

Please add redirect support #84

dfilipovic39 opened this issue Jul 26, 2014 · 9 comments

Comments

@dfilipovic39
Copy link

Could you please put additional function on contex that would redirect. Something like:

c.Writer.Header().Add("Location", "http://www.example.com")
c.Writer.WriteHeader(302)

it is very commonly used...

@Jackneill
Copy link

ctx.Writer.Header().Set("Location", "/location")
ctx.Abort(302)

Does just that.

@dfilipovic39
Copy link
Author

ok, agree, but why would one have to know the headers and status that have to be set for redirect. it should be plain and simple one-liner call like this
c.Redirect("www.somelocation.com")
or optionally with argument to set proper 3xx status (301,302...)

@johndeng
Copy link

@tarqe39 Agree, c.Redirect("http://example.com") is easy to know about the code mean.

@0x5487
Copy link
Contributor

0x5487 commented Jul 27, 2014

Agree. c.Redirect("http://example.com") is better.

@manucorporat
Copy link
Contributor

Hi guys! I just merged the Redirect pull request from @alexandernyquist in develop ceec1b6

The API is:

c.Redirect(301, "http://example.com")

@johndeng
Copy link

@manucorporat Great jobs and thanks for your work. Has been long time not hear about Gin updated.

@manucorporat
Copy link
Contributor

@johndeng I am back to work, 355 days left until next stop ;)

@johndeng
Copy link

@manucorporat wow. work so hard. hope to see the Gin move to v1.0, so i can using in production. :P

@dfilipovic39
Copy link
Author

Thx everyone :)

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

No branches or pull requests

5 participants