add: add "Vary" header to responses
Co-authored-by: Steve Chavez <stevechavezast@gmail.com>
This commit is contained in:
committed by
Steve Chavez
co-authored by
Steve Chavez
parent
d5df12c9c2
commit
1f54e2accc
@@ -1811,3 +1811,23 @@ def test_client_error_verbosity_config(defaultenv):
|
||||
"details": None,
|
||||
"hint": "Perhaps you meant the table 'public.items'",
|
||||
}
|
||||
|
||||
|
||||
def test_vary_custom_header_set(defaultenv):
|
||||
"Test default Vary header value is overridden in pre-request database function"
|
||||
|
||||
env = {**defaultenv, "PGRST_DB_PRE_REQUEST": "custom_vary_hdr"}
|
||||
|
||||
with run(env=env) as postgrest:
|
||||
response = postgrest.session.get("/projects")
|
||||
|
||||
assert response.headers["Vary"] == "X-Test-Accept"
|
||||
|
||||
|
||||
def test_vary_default_header_set(defaultenv):
|
||||
"Test default Vary header value matches default one"
|
||||
|
||||
with run(env=defaultenv) as postgrest:
|
||||
response = postgrest.session.get("/projects")
|
||||
|
||||
assert response.headers["Vary"] == "Accept, Prefer, Range"
|
||||
|
||||
Reference in New Issue
Block a user