Skip to content

Commit c057e5e

Browse files
committed
chore(chart): set content type for charts
1 parent 3bcadf9 commit c057e5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

chart/routes/get_chart.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,18 @@ async def get_chart(req: Request, currency: Currency = Depends()) -> StreamingRe
123123
)
124124

125125
chart = None
126+
format = None # TODO: rewrite
126127
match currency.backend:
127128
case "typst":
128129
chart = await typst.create_chart(currency, dates, rates)
130+
format = 'image/png'
129131
case "matplotlib":
130132
chart = await matplotlib.create_chart(currency, dates, rates)
133+
format = 'image/jpeg'
131134

132135
if chart is None:
133136
raise HTTPException(
134137
status_code=status.HTTP_400_BAD_REQUEST, detail="No data found."
135138
)
136139

137-
return StreamingResponse(chart)
140+
return StreamingResponse(chart, media_type=format)

0 commit comments

Comments
 (0)