Fandratt Muda
Fandratt Muda

Reputation: 140

Unable to POST Multipart Form in Robot Framework Using Request Library

I have the following request in postman: enter image description here

I have been using request library since the beginning automation on API: https://marketsquare.github.io/robotframework-requests/doc/RequestsLibrary.html#POST%20On%20Session

I tried to automate based on the postman request above with several trial and errors: enter image description here

It always return 400 although the headers value set already correct: enter image description here

enter image description here What did I miss in the steps above?

Thank you in advance!

Upvotes: 0

Views: 1302

Answers (2)

Fandratt Muda
Fandratt Muda

Reputation: 140

this is a false-negative due to the framework used by developers. The developer has updated their framework and it works fine now. No issues on the Robot Framework Request Library

Thank you.

Upvotes: 0

Bob Meliev
Bob Meliev

Reputation: 1198

You should pass file descriptor not dictionary and "POST On Session" accepts file as "data" argument not "files". Try this

${file_stream} =    Get File For Streaming Upload    ${file_path}
${response} =    POST On Session    ${alias}    ${URI}    data=${file_stream}

On the second line you should add the rest arguments.

P.S. Next time please don't post code as screenshot, it makes hard for someone to copy and run it.

Upvotes: 1

Related Questions