Skip to content

add TestResponse.text property#2337

Merged
davidism merged 1 commit intomainfrom
test-response-text
Feb 10, 2022
Merged

add TestResponse.text property#2337
davidism merged 1 commit intomainfrom
test-response-text

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.

1 participant