Hi Team ,
So I am using robot framework request library to send POST request with form-data body type which has two key parameters date and file so while sending this data I am getting an error of POST Response : url=https://test.com/test-upload/ status=400,
reason=Bad Request headers={‘Date’: ‘Thu, 30 Mar 2023 07:59:28 GMT’, ‘Content-Type’: ‘application/json’, ‘Content-Length’: ‘48’,
‘Connection’: ‘keep-alive’, ‘server’: ‘uvicorn’} body={“detail”:“There was an error parsing the
body”}
I have created a below script :
Create Session myssion https://test.com/
${headers}= Create Dictionary Content-Type=multipart/form-data
${reporting_date}= Set Variable 20230303
${prev_result_file}= GET FILE FOR STREAMING UPLOAD api_test/test_data/eod_valuation_20230302.xlsx
${files}= Create Dictionary file ${prev_result_file}
${data}= Create Dictionary reporting_date=${reporting_date} prev_result_file=${files}
${resp}= Post On Session myssion /test-upload/ headers=${headers} data=${data}