fix: hard-coded redirection http status on resource.redirect()
jed1976 opened this issue · comments
Summary
What:
When calling this.redirect(url, response)
, the status code is hard-coded to 302.
It would be beneficial to be able to set the status code to 301 as well for permanent redirects.
Why:
From an SEO perspective, it is considered a good practice to use 301 instead of 302 for redirecting pages.
Acceptance Criteria
Below is a list of tasks that must be completed before this issue can be closed.
- Write documentation (drashland/website-v2#100)
- Write unit tests
- Write integration tests
Example Pseudo Code (for implementation)
response.status = 301;
this.redirect(url, response);
Or possibly alter the method signature:
this.redirect(url, response, 301);
hey @joedakroub , that's actually a bug. it shouldn't be hardcoded. working on a fix. will reach out to you once i open a PR for the team to review. thanks for raising this!
hey @joedakroub , PR is open at #608. as a drashland rule, we can't release this fix/feature without documentation. i'll be writing that documentation sometime tomorrow. again, thanks for bringing up this issue!
@joedakroub , documentation is written. will have this released soon after the docs are approved. ill ping you once we release and will close out this issue afterward
hey @joedakroub! v2.5.3 is released, you can add a status code to the redirect call once you pull down that version. documentation is here: https://drash.land/drash/v2.x/tutorials/resources/redirections