*** Settings *** Library Collections Library RequestsLibrary Resource ../../03-Variable/BifangApiVariable.txt *** Variables *** *** Keywords *** GetRequestBase [Arguments] ${host} ${api} ${header} ${data} [Documentation] [Get方法封装:第一层,] Create Session api ${host} headers=${header} ${apiurl}= Run Keyword If '${data}' != '${EMPTY}' Set Variable ${api}?${data} ... ELSE Set Variable ${api} ${remoteResponse} Get Request api ${apiurl} [Return] ${remoteResponse.content} GetRequestResposeCode [Arguments] ${host} ${api} ${header} ${data} [Documentation] [Get方法封装:第二层,] ${response} GetRequestBase ${host} ${api} ${header} ${data} ${response} to json ${response} ${code} get from dictionary ${response} code [Return] ${code} GetRequestResposeData [Arguments] ${host} ${api} ${header} ${data} ${returnKey} [Documentation] [Get方法封装:第二层,] ${response} GetRequestBase ${host} ${api} ${header} ${data} ${response} to json ${response} ${returnValue} get from dictionary ${response} ${returnKey} [Return] ${returnValue} PostHttpRequestBase [Arguments] ${host} ${api} ${header} ${body} ${header} Create Dictionary Content-Type=application/json Authorization=${token} Create Session api ${host} headers=${header} ${remoteResponse} Post Request api ${api} data=${body} [Return] ${remoteResponse.content} PostRequestResposeCode [Arguments] ${host} ${api} ${header} ${data} [Documentation] [Get方法封装:第二层,] ${response} PostRequestBase ${host} ${api} ${header} ${data} ${response} to json ${response} ${code} get from dictionary ${response} code [Return] ${code} PostRequestResposeData [Arguments] ${host} ${api} ${header} ${data} ${returnKey} [Documentation] [Get方法封装:第二层,] ${response} PostRequestBase ${host} ${api} ${header} ${data} ${response} to json ${response} ${returnValue} get from dictionary ${response} ${returnKey} [Return] ${returnValue} PutRequestBase [Arguments] ${requestUri} ${data} ${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"} create session api http://${host}:${port} ${headers} ${response}= Put Request api ${requestUri} data=${data} log return data =${response} Should Be Equal As Strings ${response.status_code} 200 ${response} to json ${response.content} [Return] ${response} DeleteRequestBase [Arguments] ${url} ${data} ${header} Create Dictionary Content-Type=application/json Authorization=${token} Create Session api http://${host}:${port} headers=${header} ${remoteResponse} Delete Request api ${url} data=${data} headers=${header} ${response} to json ${remoteResponse.content} Should Be Equal As Strings ${remoteResponse.status_code} 200 [Return] ${response} UpFileRequest [Arguments] ${url} ${data} ${files} ${fileDesc} ${header} Set To Dictionary ${fileDesc} Authorization=${token} Create Session api http://${host}:${port} headers=${header} ${remoteResponse} Post Request api ${url} data=${data} files=${files} headers=${header} ${response} to json ${remoteResponse.content} Should Be Equal As Strings ${remoteResponse.status_code} 200 [Return] ${response} PutFileRequest [Arguments] ${url} ${data} ${files} ${fileDesc} ${header} Set To Dictionary ${fileDesc} Authorization=${token} Create Session api http://${host}:${port} headers=${header} ${remoteResponse} Put Request api ${url} params=${data} files=${files} headers=${header} ${response} to json ${remoteResponse.content} Should Be Equal As Strings ${remoteResponse.status_code} 200 [Return] ${response}