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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

vweb: add optional parameter to redirect function to set http code #20082

Merged
merged 2 commits into from
Dec 4, 2023

Conversation

balloondude2
Copy link
Contributor

@balloondude2 balloondude2 commented Dec 4, 2023

The vweb redirect function defaults to the 302 http code, which retains the http verb used in the request. Redirecting after reaching endpoints with verbs like DELETE will result in attempting to reach the redirected endpoint with DELETE, which may not always be desired.

This PR adds an optional parameter to the redirect function, to allow the 303 http code to be used instead, which will redirect with GET instead of the original http verb.

馃[deprecated] Generated by Copilot at a27ae8b

Enhance vweb.redirect to support various HTTP redirection types. Add http.303 constant.

馃[deprecated] Generated by Copilot at a27ae8b

  • Add a constant and a struct for handling different types of HTTP redirections (link, link)
  • Implement the logic for 303 See Other redirection (link)

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@spytheman spytheman merged commit d9e9c71 into vlang:master Dec 4, 2023
42 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants