Description
I think it is incorrect to specify HTTP error code 4xx on a JSON RPC error, say APIError raised.
In this example https://github.com/bcb/jsonrpcserver/blob/master/examples/flask_server.py we will see status codes in the 400 range for JSON RPC errors even though the transport did not fail in any way.
I think this should be a 200 as the HTTP TRANSPORT did not fail. JSON-RPC 2.0 is designed to be agnostic to the transport protocol so if the transport did its job but the RPC call itself failed, the error should be communicated inside the HTTP payload and in JSON RPC, not relaying on transport error handling mechanisms.
https://www.simple-is-better.org/json-rpc/transport_http.html
Additional motivation:
External authentication handling. I return a 403 if the authentication failed. Anything that is not a 200 is not assumed to be a JSON RPC payload but something deferred outside the concern of the JSON RPC server endpoint. One exception is 202 which could be a reasonable status code for a JSON RPC notify. The dispatch method could flag this as a "notification event" that did not respond with a JSON RPC response.
Over all I think the status_code field should be removed as it mentally connects the two things, http transport and json rpc and that should be avoided.