add: config client-error-verbosity to set error verbosity

Set error verbosity using this config. The verbosity can
be set to `verbose` or `minimal` for client error responses.

This only affects client side HTTP responses, server side logs
are not affected by this config.

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
Taimoor Zaeem
2026-02-25 15:24:27 -05:00
committed by Steve Chavez
parent 2edc44c352
commit 83dc082acf
29 changed files with 179 additions and 38 deletions
+32
View File
@@ -1757,3 +1757,35 @@ def test_server_timing_transaction_duration(defaultenv, metapostgrest):
]
assert 2000 <= response_dur < 3000
def test_client_error_verbosity_config(defaultenv):
"Test PostgREST errors with different error verbosity settings"
env = {
**defaultenv,
"PGRST_CLIENT_ERROR_VERBOSITY": "minimal", # hide details and hint
}
with run(env=env) as postgrest:
response = postgrest.session.get("/itemsxx")
assert response.status_code == 404
assert response.json() == {
"code": "PGRST205",
"message": "Could not find the table 'public.itemsxx' in the schema cache",
}
env = {
**defaultenv,
"PGRST_CLIENT_ERROR_VERBOSITY": "verbose",
}
with run(env=env) as postgrest:
response = postgrest.session.get("/itemsxx")
assert response.status_code == 404
assert response.json() == {
"code": "PGRST205",
"message": "Could not find the table 'public.itemsxx' in the schema cache",
"details": None,
"hint": "Perhaps you meant the table 'public.items'",
}