The keyword "Get Data From URI" issues a GET request for the
specified URI through the specified session, FAILs if the
request returns an error (with logging that error into Robot
logs and returns the data on success. Success is currently
defined as "returned status code 200" and the method is
hardwired to GET so this keyword is not useful for making
non-data-getting requests like POST or for GET requests
that don't return any data and return an OK-like status code
(2XX where XX != 00).
Change-Id: Iee5e894687aa9576bc4968fe851d6ab72e386872
Signed-off-by: Jozef Behran <jbehran@cisco.com>
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
[Return] ${result}
+
+Get Data From URI
+ [Arguments] ${session} ${uri} ${headers}=${NONE}
+ [Documentation] Issue a GET request and return the data obtained or on error log the error and fail.
+ ... Issues a GET request for ${uri} in ${session} using headers from
+ ... ${headers}. If the request returns a HTTP error, fails. Otherwise
+ ... returns the data obtained by the request.
+ ${response}= RequestsLibrary.Get ${session} ${uri} ${headers}
+ Builtin.Return_From_Keyword_If ${response.status_code} == 200 ${response.text}
+ Builtin.Log ${response.text}
+ Builtin.Fail The request failed with code ${response.status_code}