注意:

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} 

  

运行结果:

RF接口测试----post请求

 

相关文章:

  • 2021-05-18
  • 2021-10-11
  • 2022-01-04
  • 2021-04-30
  • 2022-01-10
  • 2022-01-08
  • 2022-01-08
  • 2021-11-23
猜你喜欢
  • 2021-04-28
  • 2021-04-12
  • 2022-01-01
  • 2021-12-21
  • 2021-10-03
  • 2021-12-09
  • 2022-01-14
相关资源
相似解决方案