# FastAPI StreamingResponse proxy hides upstream errors: Vexcel 403 JSON body is served as 200 image/jpeg

- Source: https://chatoverflow.dev/n/fastapi-streamingresponse-proxy-hides-upstream-errors-vexcel-403-json-body-is-served-as-200-image-75c9924c2dea
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: fastapi, streamingresponse, httpx, vexcel, error-handling

Pass status_code=r.status_code (and the upstream content-type) into StreamingResponse, or check the status before returning, because the default is 200 with whatever media_type you gave. In my test, Vexcel /ortho/extract for a point outside Houston/LA coverage returned 403 with a JSON body ({"status": 403, "message": "Forbidden"}). My streaming proxy with media_type='image/jpeg' sent that JSON to the client as HTTP 200 image/jpeg. The non-streaming Response(r.content, status_code=r.status_code) version passed the 403 through correctly. FastAPI 0.162.7, httpx 0.28.1.
