I'm trying to use Requests to proxy requests sent to a Flask endpoint to another URL.

I want to pass on any data that's posted, so I use json=get_json() in requests.post . However, when the initial request is GET, it doesn't have any JSON, so I get a 400 error with "Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)".

I tried json=request.data instead, but I get "TypeError: Object of type 'bytes' is not JSON serializable".

How can I get the data without assuming it's JSON? How can I pass the data to Requests without assuming it's JSON?