getsentry / responses

A utility for mocking out the Python Requests library.
Apache License 2.0
4.08k stars 348 forks source link

Support gzipped request.body in json_params_matcher #665

Closed haakonvt closed 10 months ago

haakonvt commented 10 months ago

I just discovered matchers (absolute lifesaver in concurrent tests), but I currently need to disable gzip for the tests since it isn't supported ootb.

Ltmk if there are additional changed/updates/changelog entries etc. you want me to create πŸ˜„

codecov[bot] commented 10 months ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (771477f) 100.00% compared to head (c90f987) 100.00%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #665 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 9 9 Lines 2968 2979 +11 ========================================= + Hits 2968 2979 +11 ``` | [Files Changed](https://app.codecov.io/gh/getsentry/responses/pull/665?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Ξ” | | |---|---|---| | [responses/matchers.py](https://app.codecov.io/gh/getsentry/responses/pull/665?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-cmVzcG9uc2VzL21hdGNoZXJzLnB5) | `100.00% <100.00%> (ΓΈ)` | | | [responses/tests/test\_matchers.py](https://app.codecov.io/gh/getsentry/responses/pull/665?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-cmVzcG9uc2VzL3Rlc3RzL3Rlc3RfbWF0Y2hlcnMucHk=) | `100.00% <100.00%> (ΓΈ)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

markstory commented 10 months ago

Looking good. There is an error from mypy that will need to be resolved before this can be merged.

responses/matchers.py:132:52: error: Argument 1 to "decompress" has incompatible type "bytes | str"; expected "Buffer" [arg-type]

haakonvt commented 10 months ago

Looking good. There is an error from mypy that will need to be resolved before this can be merged.

responses/matchers.py:132:52: error: Argument 1 to "decompress" has incompatible type "bytes | str"; expected "Buffer" [arg-type]

That one surprised me, seems like mypy think the error can be raised after variable has been updated... I wasn't sure how you feel about cast in this codebase, so I changed a few request_body to request.body to help mypy understand.

markstory commented 10 months ago

Thank you πŸŽ‰