Skip to content

Commit

Permalink
[backport] fix streaming response
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Jan 10, 2024
1 parent 2e03692 commit 411eed9
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions tipg/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,19 +753,27 @@ async def items( # noqa: C901
MediaType.json,
MediaType.ndjson,
):
rows = (
{
k: v
for k, v in {
if any(
[f.get("geometry", None) is not None for f in item_list["items"]]
):
rows = (
{
"collectionId": collection.id,
"itemId": f.get("id"),
**f.get("properties", {}),
"geometry": f.get("geometry", None),
}.items()
if v is not None
}
for f in item_list["items"]
)
}
for f in item_list["items"]
)
else:
rows = (
{
"collectionId": collection.id,
"itemId": f.get("id"),
**f.get("properties", {}),
}
for f in item_list["items"]
)

# CSV Response
if output_type == MediaType.csv:
Expand Down

0 comments on commit 411eed9

Please sign in to comment.