feat: improve error details of PGRST301 error

This commit is contained in:
Taimoor Zaeem
2025-09-14 13:37:17 -05:00
committed by Steve Chavez
parent 75972e9ffe
commit a8f40c4908
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,