接口请求构造

接口请求构造

还是基于http/https协议的测试

当要测试一个目标网站时,我们需要了解:

  1. 它使用的协议
  2. 它的接口路径
  3. 构建对应的一些请求,请求的一些参数,可能还要自定义加上一些header,完成业务场景的模拟

一、请求目标构造

二、请求参数构造

  1. get query请求

  

   2. post body

    0.1 form

    

     0.2 文件上传

    

 

 三、header和cookie构造

    def test_header(self):
        headers = {"h":"header demo"}
        r = requests.get('https://httpbin.testing-studio.com/get',headers=headers)
        print(r.text)

 

posted @ 2022-02-26 18:16  云啊云的囤粮地  阅读(53)  评论(0)    收藏  举报