getsentry / responses

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

fix: Missing header detection for the non-strict case #702

Closed woodyza closed 5 months ago

woodyza commented 5 months ago

Hi!

When #651 was implemented the header matching rule was subtly broken, making it no longer detect when the specified headers were missing entirely (vs present, but with the wrong value) unless you used strict matching.

As far as I understand that is not the intention, and you should be able to use the header matcher to detect missing headers without necessarily caring about all of the other headers in the request. It's a small change to enable that, and it preserves the strict match and regex match logic.

I've added a test case that fails without the current change, and the rest of the cases still pass with it in place.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (89d7f37) 99.93% compared to head (dd7b873) 99.93%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #702 +/- ## ======================================= Coverage 99.93% 99.93% ======================================= Files 9 9 Lines 3054 3064 +10 ======================================= + Hits 3052 3062 +10 Misses 2 2 ```

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

markstory commented 5 months ago

Thank you 🎉

woodyza commented 4 months ago

Thanks @markstory for the merge 🙏 Any idea when 0.25.0 might come out?

markstory commented 4 months ago

@woodyza I started a release build just now.

woodyza commented 4 months ago

Awesome, thanks!