Skip to content

Commit

Permalink
Ignore _shape when returning errors, refs #619
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 2, 2021
1 parent bd7521b commit 3bffc35
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datasette/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def convert_specific_columns_to_json(rows, columns, json_cols):
def json_renderer(args, data, view_name):
"""Render a response as JSON"""
status_code = 200

# Handle the _json= parameter which may modify data["rows"]
json_cols = []
if "_json" in args:
Expand All @@ -44,6 +45,9 @@ def json_renderer(args, data, view_name):

# Deal with the _shape option
shape = args.get("_shape", "arrays")
# if there's an error, ignore the shape entirely
if data.get("error"):
shape = "arrays"

next_url = data.get("next_url")

Expand Down

0 comments on commit 3bffc35

Please sign in to comment.