Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix!: Updated PreconditionFailed responses #5513

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

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

DiscoRiver
Copy link
Contributor

Summary

In all cases where a 412 Precondition Failed is used, it is actually a 400 Bad Request response (often with a descriptor for the particular reason).

It's easy to see why status 412 was used, because on a surface level it makes sense. You're waiting on a condition for a successful request, like a job completing, workspaces to be deleted before removing a template, configuring a particular oauth method etc..

However, these requests aren't conditional, and should be represented as bad requests. Think of it like being told the ice cream machine at McDonalds is broken, but you keep re-ordering the ice cream in the exact same way; technically there is a precondition failure that the ice cream machine is working, but that's not factored into your request. If you were to validate the state of the ice cream machine beforehand, maybe it would be different, but you're making a request against an ice cream machine that happens to be broken, so in that way you're making a bad/unreasonable request.

@github-actions
Copy link

github-actions bot commented Dec 29, 2022

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@DiscoRiver DiscoRiver changed the title Updated PreconditionFailed responses fix!: Updated PreconditionFailed responses Dec 29, 2022
@DiscoRiver
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@kylecarbs
Copy link
Member

Thanks for the contribution @DiscoRiver 🥳! I agree with your rationale.

@kylecarbs kylecarbs merged commit 54cc587 into coder:main Jan 13, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2023
@mafredri mafredri added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Jan 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release/breaking This label is applied to PRs to detect breaking changes as part of the release process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop using http.StatusPreconditionFailed as a response status code
3 participants