Below is my code snippet in which i am trying to read the data from request body.
from fastapi import Request
async def my_action(request: Request):
data = await request.body()
print(data) #prints the data as mentioned below in o/p
print(data.decode("utf-8")) #prints data in the same way as mentioned in o/p
print(data.decode()) #prints data in the same way as mentioned in o/p
i/p : "process query=my_event my_User=king Prop_A="Prop Val" Prop_B=Val_B other=1 Minutes"
o/p : b'process+query%3Dmy_event+my_User%3Dking+Prop_A%3D%22Prop+Val%22+Prop_B%3DVal_B+other%3D1+Minutes'
Problem here is, when I try to decode the byte stream, it still prints the same data as in the byte format. So how can I decode it to get it in the same format as in i/p ?
Thanks in advance!