Skip to content

[handlers] add link response headers#240

Open
capcom6 wants to merge 2 commits into
masterfrom
handlers/add-link-response-headers
Open

[handlers] add link response headers#240
capcom6 wants to merge 2 commits into
masterfrom
handlers/add-link-response-headers

Conversation

@capcom6

@capcom6 capcom6 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Root endpoint (/) now redirects to the public path with HTTP 301 status
    • Legacy /api paths automatically redirect to /api/docs documentation with HTTP 301 status
    • Link headers added to redirect responses for improved API discoverability

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@capcom6, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 26 minutes and 39 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d670bd96-392a-42ff-8537-2a9bd82f84a0

📥 Commits

Reviewing files that changed from the base of the PR and between 8b2cf00 and b803b73.

📒 Files selected for processing (1)
  • internal/sms-gateway/handlers/root.go
📝 Walkthrough

Walkthrough

The root handler gains an explicit GET "/" route that calls a new setLinkHeaders helper and redirects to PublicPath with HTTP 301. The registerOpenAPI middleware is updated to call the same setLinkHeaders before redirecting /api and /api/ to /api/docs. A no-redirect HTTP test request for the root endpoint is added.

Changes

Root redirect and Link header wiring

Layer / File(s) Summary
Root handler, Link header helper, and /api middleware update
internal/sms-gateway/handlers/root.go, api/requests.http
Register routes GET "/" to handleRoot, which calls setLinkHeaders and issues a 301 to PublicPath. setLinkHeaders trims the trailing slash from PublicPath and writes a Link header with API catalog/service-doc references. registerOpenAPI middleware now calls setLinkHeaders before redirecting /api and /api/ to /api/docs. A # @no-redirect`` HTTP test request for http://localhost:3000/ is added to validate the response.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[handlers] add link response headers' accurately describes the main change: adding Link response headers to handlers in the root.go file, and is clear and specific.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/sms-gateway/handlers/root.go`:
- Line 42: The return statement using c.Redirect method is returning an
unwrapped error from an external package, which violates the wrapcheck linter.
Either wrap the error returned by c.Redirect using fmt.Errorf with the %w verb
to add context, or add a //nolint:wrapcheck comment on the line if returning the
error unwrapped is intentional for this passthrough case.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97695654-5aa3-426a-a3a6-d0c088df80cc

📥 Commits

Reviewing files that changed from the base of the PR and between f914877 and 8b2cf00.

📒 Files selected for processing (2)
  • api/requests.http
  • internal/sms-gateway/handlers/root.go

Comment thread internal/sms-gateway/handlers/root.go Outdated
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 server_Darwin_arm64.tar.gz
🍎 Darwin x86_64 server_Darwin_x86_64.tar.gz
🐧 Linux arm64 server_Linux_arm64.tar.gz
🐧 Linux i386 server_Linux_i386.tar.gz
🐧 Linux x86_64 server_Linux_x86_64.tar.gz
🪟 Windows arm64 server_Windows_arm64.zip
🪟 Windows i386 server_Windows_i386.zip
🪟 Windows x86_64 server_Windows_x86_64.zip

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.

1 participant