注意:
RF的post請求中必須帶headers(消息頭),否則會報參數為空。
代碼:
*** Settings *** Library RequestsLibrary *** Test Cases *** 聚合數據----天氣預報查詢--post請求 Create Session weathersearch http://apis.juhe.cn &{params}= Create Dictionary city=上海 key=e3cf8a6c0b....2c45df6ae409679 &{headers}= Create Dictionary Content-Type=application/x-www-form-urlencoded Log ${params} ${response}= Post Request weathersearch /simpleWeather/query params=${params} Log ${response.text} Log ${response.status_code}
運行結果: