-
Notifications
You must be signed in to change notification settings - Fork 152
Add e2e tests for HTTP behavior consistency #4071
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
Conversation
e88e78f to
e858b62
Compare
Add tests to verify HTTP behavior before warp-to-axum migration: - cors.rs: CORS preflight and headers on error responses - missing_endpoints.rs: 404 for invalid/nonexistent routes - malformed_requests.rs: Path parameter validation (returns 404), request body validation (returns 400), and error response format
bb7c76c to
d36402f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds end-to-end tests for HTTP behavior consistency. The assertions in the CORS preflight tests are not sufficiently strict, as they use substring checks on comma-separated header values. This can result in false positives. I have suggested replacing these with more robust checks that parse the header values and verify exact matches to ensure test reliability.
MartinquaXD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright to me. Judging by the tests a reasonable rule of thumb seems to be:
can't find path or parse the URL components => 404
URL parses find but body is malformed => 400
Yeah because a malformed path is basically a non-existing one, I think it makes more sense like this |
Co-authored-by: ilya <ilya@cow.fi>
Description
Add e2e tests to verify HTTP behavior consistency before the warp-to-axum migration.
Changes
cors.rs- Tests for CORS preflight requests and CORS headers on error responsesmissing_endpoints.rs- Tests that invalid/nonexistent routes return 404malformed_requests.rs- Tests for:errorTypeanddescription)How to test
Run the new e2e tests: