Hi,
i"m trying to send a Post request with Robot framework like i do with Postman:
in Postman i send a Podt request with body which is in form-data and contains some value like:
data: 2.2.2,aaa.111
name: test
and i validate the respons status 201
it works fine.
Now i want to do the same with Robot Framework:
test-1: i send a Post request for login where i validate response status with 200 and save the token as global variable.
test-1 works fine.
test-2: i send a Post request to create an account and i have to validate the response status 201.
it uses the global variable token.
*** Variables ***
${data} 2.2.2,aaa.111
${name} test
*** Test Cases ***
Create_account
Create Session test ${base_url} verify=False
${body}= Create Dictionary data=${data} name=${name}
${headers}= Create Dictionary Cache-Control=no-cache Content-Type=application/json charset=UTF-8-BOM Authorization=Bearer ${token}
${response}= POST On Session test json=${body} headers=${headers}
Should Be Equal As strings ${response.status_code} 201
When i excute the Create_account it returns HTTPError: 400 Client invalid request
i am not able to log the response because it stops at post session.
in the Log test, i see invalid request for the url…
If i open the url it says status: 401 and no_authenticated
I log the token at then end of login test and at the begining of the create account test and compare them, they are exactly the same.
In the log test: i see the same token in login and create account.
so i don’t understand why i receive a 400 error.
Any help/
Thank you