mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed bug with ?_trace=1 and large responses, closes #2404
This commit is contained in:
parent
9028d7f805
commit
34a6b2ac84
3 changed files with 23 additions and 1 deletions
|
|
@ -53,6 +53,23 @@ def test_trace(trace_debug):
|
|||
assert all(isinstance(trace["count"], int) for trace in execute_manys)
|
||||
|
||||
|
||||
def test_trace_silently_fails_for_large_page():
|
||||
# Max HTML size is 256KB
|
||||
with make_app_client(settings={"trace_debug": True}) as client:
|
||||
# Small response should have trace
|
||||
small_response = client.get("/fixtures/simple_primary_key.json?_trace=1")
|
||||
assert small_response.status == 200
|
||||
assert "_trace" in small_response.json
|
||||
|
||||
# Big response should not
|
||||
big_response = client.get(
|
||||
"/fixtures/-/query.json",
|
||||
params={"_trace": 1, "sql": "select zeroblob(1024 * 256)"},
|
||||
)
|
||||
assert big_response.status == 200
|
||||
assert "_trace" not in big_response.json
|
||||
|
||||
|
||||
def test_trace_parallel_queries():
|
||||
with make_app_client(settings={"trace_debug": True}) as client:
|
||||
response = client.get("/parallel-queries?_trace=1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue