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

Refactor call stats with easier api #85

Merged
merged 8 commits into from
Oct 9, 2020

Conversation

SlavaSkvortsov
Copy link
Contributor

Inspired by requests_mock last_request property. I found it very convenient

Copy link
Owner

@lundberg lundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great feature!

respx/models.py Outdated Show resolved Hide resolved
@SlavaSkvortsov
Copy link
Contributor Author

So, you've expected something like this, right?

@SlavaSkvortsov
Copy link
Contributor Author

SlavaSkvortsov commented Oct 4, 2020

Also, my PRs to this repo in the Hacktoberfest are marked as Ineligible Repository with the reason Your PR was submitted to a repository that is not participating in Hacktoberfest. Maintainers of the repository can add the "hacktoberfest" topic to their repository if they wish to participate. May I ask you to add the topic?

@lundberg lundberg changed the title Add last_request property Refactor call stats for with easier api Oct 5, 2020
Copy link
Owner

@lundberg lundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great implementation! Nice touch with the NamedTuple.

Address my comment, rebase with master, and we're good to merge 👍🏻

respx/models.py Outdated Show resolved Hide resolved
@lundberg lundberg changed the title Refactor call stats for with easier api Refactor call stats with easier api Oct 5, 2020
SlavaSkvortsov and others added 5 commits October 6, 2020 10:15
Co-authored-by: Jonas Lundberg <jonas@5monkeys.se>
@SlavaSkvortsov
Copy link
Contributor Author

And again, I don't want to do shitty contributions, but I want the Hacktoberfest T-shirt, so could you add hacktoberfest tag to the repo or hacktoberfest-accepted label to my PRs?
ref: https://hacktoberfest.digitalocean.com/hacktoberfest-update

@lundberg lundberg merged commit cccdf92 into lundberg:master Oct 9, 2020
lundberg added a commit that referenced this pull request Oct 15, 2020
Added
- Added `text`, `html` and `json` content shorthands to ResponseTemplate. (PR #82)
- Added `text`, `html` and `json` content shorthands to high level API. (PR #93)
- Added support to set `http_version` for a mocked response. (PR #82)
- Added support for mocking by lowercase http methods, thanks @lbillinghamtn. (PR #80)
- Added query `params` to align with HTTPX API, thanks @jocke-l. (PR #81)
- Easier API to get request/response from call stats, thanks @SlavaSkvortsov. (PR #85)
- Enhanced test to verify better content encoding by HTTPX. (PR #78)
- Added Python 3.9 to supported versions and test suite, thanks @jairhenrique. (PR #89)

Changed
- `ResponseTemplate.content` as proper getter, i.e. no resolve/encode to bytes. (PR #82)
- Enhanced headers by using HTTPX Response when encoding raw responses. (PR #82)
- Deprecated `respx.stats` in favour of `respx.calls`, thanks @SlavaSkvortsov. (PR #92)

Fixed
- Recorded requests in call stats are pre-read like the responses. (PR #86)
- Postponed request decoding for enhanced performance. (PR #91)
- Lazy call history for enhanced performance, thanks @SlavaSkvortsov. (PR #92)

Removed
- Removed auto setting the `Content-Type: text/plain` header. (PR #82)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants