test: align with secure 500 and CORS origin semantics
swadhinbiswas committed 3 months ago
f20419c
1 parent 4ace57f
commit f20419c
1 file changed
+3 -1
Showing 1 changed file+3-1
▼crates/justapi-py/python/justapi/test_exceptions.py
+3-1
| @@ -83,7 +83,9 @@ def test_unhandled_exception_is_500(): | ||
83 | 83 | |
84 | 84 | resp = JustAPITestClient(app).get("/explode") |
85 | 85 | assert resp["status"] == 500 |
86 | - assert "kaboom" in resp["body"].decode() | |
86 | + # Secure default: internal error details must NOT leak to the client. | |
87 | + assert "kaboom" not in resp["body"].decode() | |
88 | + assert json.loads(resp["body"])["error"] == "internal server error" | |
87 | 89 | |
88 | 90 | |
89 | 91 | def test_request_validation_error_422(): |
90 | 92 | |