Skip to content

fix: return HTTP 404 for unknown agency ID in stop-ids-for-agency#975

Merged
burma-shave merged 1 commit into
OneBusAway:mainfrom
ARCoder181105:fix/stop-ids-for-agency-unknown-agency-404
Jun 3, 2026
Merged

fix: return HTTP 404 for unknown agency ID in stop-ids-for-agency#975
burma-shave merged 1 commit into
OneBusAway:mainfrom
ARCoder181105:fix/stop-ids-for-agency-unknown-agency-404

Conversation

@ARCoder181105
Copy link
Copy Markdown
Collaborator

Summary

Fixed stop-ids-for-agency endpoint to return HTTP 404
when an unknown agency ID is provided instead of
HTTP 200 with a null body.

Problem

When an unknown agency ID is provided, the endpoint
was returning HTTP 200 with a null body instead of
a proper HTTP 404 response.

Changes

  • Updated agency handler to call sendNotFound() when
    agency ID is not found in the transit graph

Testing

Before fix:
Request: GET /api/where/stop-ids-for-agency/999.json?key=test
HTTP Status: 200
Body: null

After fix:
Request: GET /api/where/stop-ids-for-agency/999.json?key=test
HTTP Status: 404
Body: {"code":404,"currentTime":1779991625902,"text":"resource not found","version":2}

Spec Reference

https://github.com/OneBusAway/maglev/wiki/stop-ids-for-agency

Proof

image

Closes #974

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

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

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

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ 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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a809fd6-c870-40c8-90b7-fc1f197aa349

📥 Commits

Reviewing files that changed from the base of the PR and between d259682 and f3da5d9.

📒 Files selected for processing (2)
  • internal/restapi/stop_ids_for_agency_handler.go
  • internal/restapi/stop_ids_for_agency_handler_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@sonarqubecloud
Copy link
Copy Markdown

@ARCoder181105
Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

✅ Actions performed

Full review triggered.

@ARCoder181105 ARCoder181105 requested a review from burma-shave May 31, 2026 16:14
@burma-shave burma-shave merged commit 0ed4181 into OneBusAway:main Jun 3, 2026
9 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.

spec-gap: stop-ids-for-agency returns HTTP 200 + null for unknown agency instead of 404

2 participants