Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【需求】添加获取response返回的header信息 #144

Closed
792817377 opened this issue Sep 14, 2022 · 1 comment
Closed

【需求】添加获取response返回的header信息 #144

792817377 opened this issue Sep 14, 2022 · 1 comment

Comments

@792817377
Copy link

目前看只有获取response,self.response
希望可以添加获取响应请求头信息

@defnngj
Copy link
Collaborator

defnngj commented Oct 17, 2022

@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'}

@defnngj defnngj closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants