I am learning robot-framework, API automation:
*** Settings ***
Library RequestsLibrary
Library Collections
Library String
*** Variables ***
${headers} Create Dictionary Authorization Bearer abcde
*** Test Cases ***
Make a simple REST API call
[Tags] API
Create Session my_json http://localhost:3000
Log ${headers}
${response} = Get Request my_json /posts headers=${headers}
Log ${response}
# Check the Response status
Should Be Equal As Strings ${response.status_code} 403
# ${response} = Get Request my_json /posts
${json} = Set Variable ${response.json()}
Log ${json}
Log len(${json})
Should Be Equal As Strings ${json['name']} rajesh
I am getting this error in log.html
Documentation: Send a GET request on the session object found using the given
aliasStart / End / Elapsed: 20181209 18:43:04.159 / 20181209 18:43:04.175 / 00:00:00.016 18:43:04.175 FAIL AttributeError: 'str' object has no attribute 'items'