seldom
seldom copied to clipboard
【需求】添加获取response返回的header信息
目前看只有获取response,self.response 希望可以添加获取响应请求头信息
@792817377 seldom 2.9.0 版本支持返回对象。
import seldom
class TestRequest(seldom.TestCase):
def test_get(self):
""" test getrequest """
resp = self.get('http://httpbin.org/get', data={'key': 'value'})
print(resp.headers)
if __name__ == '__main__':
seldom.main(debug=True)
resp.headers 打印结果:
{'Server': 'nginx/1.20.1', 'Date': 'Mon, 17 Oct 2022 15:45:36 GMT', 'Content-Type': 'text/html', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Last-Modified': 'Wed, 12 Oct 2022 02:59:42 GMT', 'Cache-Control': 'public, max-age=0, must-revalidate', 'Content-Encoding': 'gzip'}