Reputation: 35
I want to send some parameters to server by using "Robot framework".
I wrote code just like below.
*** Setting ***
Library REST myserver.com
*** Variable ***
&dict = auth_key=******
*** Test Cases ***
Send Auth Key and Get Access Token.
POST /auth ${dict}
Integer response status 200
But server receives no params.
How I correct code?
Thanks.
Upvotes: 1
Views: 90
Reputation: 2881
If you are using REST library it is not being updated anymore. I would suggest to use Request-Library it is built on top of the requests library in python.
Here is a example of a Post request with Json data.
Post Requests with Json Data
[Tags] post
Create Session httpbin http://httpbin.org
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
${resp}= Post Request httpbin /post json=${data}
Should Be Equal As Strings ${resp.status_code} 200
${jsondata}= To Json ${resp.content}
Should Be Equal ${jsondata['json']} ${data}
Change your test case to:
*** Settings ***
Library RequestsLibrary
*** Test Cases ***
Send Auth Key and Get Access Token.
Create Session Gateway https://URLHERE
&{dict} = Create Dictionary auth_key=******
${resp}= Post Request Gateway /auth json=${dict}
Should Be Equal As Strings ${resp.status_code} 200
Upvotes: 1