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

add TestResponse.text property #2337

Merged
merged 1 commit into from
Feb 10, 2022
Merged

add TestResponse.text property #2337

merged 1 commit into from
Feb 10, 2022

Conversation

davidism
Copy link
Member

Pretty much every test I write about the body of a response, I want to treat the response data as text, not as bytes. This adds a shortcut property TestResponse.text that does response.get_data(as_text=True). The property matches the name used in requests and httpx. I opted to only implement this for tests, not on Response, since I think it only really makes sense during testing.

@davidism davidism added this to the 2.1.0 milestone Feb 10, 2022
@davidism davidism merged commit 8292df2 into main Feb 10, 2022
@davidism davidism deleted the test-response-text branch February 10, 2022 15:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant