HttpRunner(5):模拟请求中带有 headers 的接口

headers

可通过headers 添加头部信息,如下图

# 发送请求头headers的接口
- config:
    name: 百度接口用例
    base_url: https://www.baidu.com

- test:
    name: 发送百度接口的头部信息
    request:
      url: /s
      method: GET
      headers:
        Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
        Accept-Encoding: gzip, deflate, br
        Accept-Language: zh-CN,zh;q=0.9
        Cache-Control: max-age=0
        Connection: keep-alive
        User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
      params:
          wd: 猫
    validate:
      - eq: [status_code,200]

 

posted @ 2021-09-27 16:03  奔跑在路上you  阅读(181)  评论(0编辑  收藏  举报