lundberg / respx

Mock HTTPX with awesome request patterns and response side effects 🦋
https://lundberg.github.io/respx
BSD 3-Clause "New" or "Revised" License
581 stars 38 forks source link

Add `files` pattern #253

Closed lundberg closed 4 months ago

lundberg commented 4 months ago

Add support for matching on file uploads.

Example:

respx.post("https://example.org/", files={"some_file": b"..."})
respx.post("https://example.org/", files={"some_file": ANY})
respx.post("https://example.org/", files={"some_file": ("filename.txt", b"...")})
respx.post("https://example.org/", files={"some_file": ("filename.txt", ANY)})

Fixes #115

codecov[bot] commented 4 months ago

Codecov Report

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

:exclamation: No coverage uploaded for pull request base (master@07ae887). Click here to learn what that means.

:exclamation: Current head b66080b differs from pull request most recent head c1a38e8. Consider uploading reports for the commit c1a38e8 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #253 +/- ## ========================================== Coverage ? 100.00% ========================================== Files ? 21 Lines ? 2845 Branches ? 428 ========================================== Hits ? 2845 Misses ? 0 Partials ? 0 ```

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

ziima commented 4 months ago

Works for me. Files content types are not checked, but that may be fixed later.