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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust "version invalid / not found" errors to reply with "404 Not Found" #7851

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Jan 2, 2024

We don't need to use cargo_err() (aka. "200 OK") responses in these error cases anymore since the cargo compat middleware will ensure that we reply with a compatible status code for cargo-relevant endpoints.

This PR extracts a new version_not_found() fn and then adjusts its implementation to respond with "404 Not Found" instead.

Related:

The `semver::Version::parse()` call is only used to avoid getting a database connection from the pool when we already know that such a version can't exist in the database. In that case we don't need to reply with a special error message though, and can instead reply with the same error that we send when a version isn't found in the database.
@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Jan 2, 2024
@Turbo87 Turbo87 requested a review from a team January 2, 2024 14:02
@Turbo87 Turbo87 merged commit 341c90a into rust-lang:main Jan 3, 2024
6 checks passed
@Turbo87 Turbo87 deleted the version-not-found branch January 3, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants