dispatchrun / dispatch-py

Python package to develop applications with Dispatch.
https://pypi.org/project/dispatch-py/
Apache License 2.0
56 stars 3 forks source link

fastpi: return error responses formatted for the connectrpc protocol #77

Closed achille-roussel closed 8 months ago

achille-roussel commented 8 months ago

This PR changes the FastAPI adapter to return error responses in the format expected by the Connect protocol (see https://connectrpc.com/docs/protocol/#error-end-stream).

All errors will now be reported as a http response with a non-200 status code, and a JSON body with this shape:

{
  "code": "...",
  "message": "..."
}

Two status codes are now reserved to indicate issues with http request signatures: