1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Kevin McCarthy
f3f66086a1 Release v4.2.1 2022-08-31 14:14:32 -05:00
Ville Skyttä
c3767c2fdb fix(aiohttp): record body of first request in redirect chain
The first could be e.g. a POST with one, only the remaining ones are
expected to be GETs without one.
2022-08-31 14:11:55 -05:00
Joel Shprentz
6fff3ab952 Add match_on option scheme in configuration.rst
Minor documentation corrections: The list of ``match_on`` options was missing ``scheme``. Also, an unneeded period appeared after URI.
2022-08-04 08:42:36 -03:00
Tim Gates
35378d046f docs: Fix a few typos
There are small typos in:
- tests/integration/test_record_mode.py
- tests/integration/test_stubs.py
- vcr/stubs/__init__.py

Fixes:
- Should read `repercussions` rather than `repurcussions`.
- Should read `superclass` rather than `superclas`.
- Should read `cassette` rather than `casssette`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-08-04 08:42:13 -03:00
7 changed files with 13 additions and 9 deletions

View File

@@ -7,6 +7,9 @@ For a full list of triaged issues, bugs and PRs and what release they are target
All help in providing PRs to close out bug issues is appreciated. Even if that is providing a repo that fully replicates issues. We have very generous contributors that have added these to bug issues which meant another contributor picked up the bug and closed it out.
- 4.2.1
- Fix a bug where the first request in a redirect chain was not being recorded with aiohttp
- Various typos and small fixes, thanks @jairhenrique, @timgates42
- 4.2.0
- Drop support for python < 3.7, thanks @jairhenrique, @IvanMalison, @AthulMuralidhar
- Various aiohtt bigfixes (thanks @pauloromeira and boechat107)

View File

@@ -42,7 +42,8 @@ This can be configured by changing the ``match_on`` setting.
The following options are available :
- method (for example, POST or GET)
- uri (the full URI.)
- uri (the full URI)
- scheme (for example, HTTP or HTTPS)
- host (the hostname of the server receiving the request)
- port (the port of the server receiving the request)
- path (the path of the request)

View File

@@ -57,7 +57,7 @@ def test_new_episodes_record_mode(tmpdir, httpbin):
assert cass.all_played
# in the "new_episodes" record mode, we can add more requests to
# a cassette without repurcussions.
# a cassette without repercussions.
urlopen(httpbin.url + "/get").read()
# one of the responses has been played
@@ -108,7 +108,7 @@ def test_all_record_mode(tmpdir, httpbin):
urlopen(httpbin.url).read()
# in the "all" record mode, we can add more requests to
# a cassette without repurcussions.
# a cassette without repercussions.
urlopen(httpbin.url + "/get").read()
# The cassette was never actually played, even though it existed.

View File

@@ -64,7 +64,7 @@ def test_original_decoded_response_is_not_modified(tmpdir, httpbin):
inside = conn.getresponse()
# Assert that we do not modify the original response while appending
# to the casssette.
# to the cassette.
assert "gzip" == inside.headers["content-encoding"]
# They should effectively be the same response.

View File

@@ -3,7 +3,7 @@ from .config import VCR
from logging import NullHandler
from .record_mode import RecordMode as mode # noqa import is not used in this file
__version__ = "4.2.0"
__version__ = "4.2.1"
logging.getLogger(__name__).addHandler(NullHandler())

View File

@@ -87,7 +87,7 @@ class VCRHTTPResponse(HTTPResponse):
def closed(self):
# in python3, I can't change the value of self.closed. So I'
# twiddling self._closed and using this property to shadow the real
# self.closed from the superclas
# self.closed from the superclass
return self._closed
def read(self, *args, **kwargs):

View File

@@ -177,14 +177,14 @@ async def record_responses(cassette, vcr_request, response):
to the final destination.
"""
for past_response in response.history:
for i, past_response in enumerate(response.history):
aiohttp_request = past_response.request_info
# No data because it's following a redirect.
past_request = Request(
aiohttp_request.method,
str(aiohttp_request.url),
None,
# Record body of first request, rest are following a redirect.
None if i else vcr_request.body,
_serialize_headers(aiohttp_request.headers),
)
await record_response(cassette, past_request, past_response)