Skip to content

feat(core): support other status codes in Redirect - #636

Open
m4tx wants to merge 1 commit into
masterfrom
redirect-statuses
Open

feat(core): support other status codes in Redirect#636
m4tx wants to merge 1 commit into
masterfrom
redirect-statuses

Conversation

@m4tx

@m4tx m4tx commented Aug 7, 2026

Copy link
Copy Markdown
Member

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Performance improvement
  • Other (describe above)

@m4tx
m4tx requested review from a team and a lite review from Copilot August 7, 2026 18:19
@github-actions github-actions Bot added the C-core label Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Cot’s Redirect response type to support multiple redirect status codes (beyond the previous fixed 303 See Other), while keeping Redirect::new as the ergonomic default for typical post/redirect/get flows.

Changes:

  • Refactored Redirect from a single String into a struct carrying both location and status_code.
  • Added constructors for common redirect semantics (see_other, permanent, temporary) plus a validated with_status_code.
  • Updated IntoResponse for Redirect and added tests to cover the new behavior (including validation panic for non-3xx codes).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cot-core/src/response/into_response.rs Builds redirect responses using the new Redirect accessors (status_code() / location()).
cot-core/src/response.rs Introduces the new Redirect struct shape, adds redirect constructors/accessors, and adds tests for status code + location behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectcot
Branchredirect-statuses
Testbedgithub-ubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
14,152.00 µs
(+78.06%)Baseline: 7,948.08 µs
14,750.67 µs
(95.94%)
json_api/json_api📈 view plot
🚷 view threshold
1,003.60 µs
(-5.93%)Baseline: 1,066.89 µs
1,384.95 µs
(72.46%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
969.96 µs
(-2.60%)Baseline: 995.88 µs
1,263.08 µs
(76.79%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
942.48 µs
(-1.73%)Baseline: 959.04 µs
1,226.81 µs
(76.82%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
18,148.00 µs
(+5.57%)Baseline: 17,189.72 µs
21,743.12 µs
(83.47%)
🐰 View full continuous benchmarking report in Bencher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants