feat: improve error details of PGRST301 error

This commit is contained in:
Taimoor Zaeem
2025-05-31 13:30:32 -05:00
committed by Steve Chavez
parent f6316b86e4
commit c5ccf742d6
4 changed files with 18 additions and 6 deletions
+7
View File
@@ -93,6 +93,9 @@ def test_jwt_errors(defaultenv):
response = postgrest.session.get("/", headers=headers)
assert response.status_code == 401
assert response.json()["message"] == "No suitable key or wrong key type"
assert (
response.json()["details"] == "None of the keys was able to decode the JWT"
)
headers = jwtauthheader({"role": "not_existing"}, SECRET)
response = postgrest.session.get("/", headers=headers)
@@ -141,6 +144,10 @@ def test_jwt_errors(defaultenv):
response = postgrest.session.get("/", headers=headers)
assert response.status_code == 401
assert response.json()["message"] == "Wrong or unsupported encoding algorithm"
assert (
response.json()["details"]
== "JWT is unsecured but expected 'alg' was not 'none'"
)
env = {
**defaultenv,