| |
@@ -0,0 +1,76 @@
|
| |
+ From 141555895002d6b933ad2b6f03ae402291d7a427 Mon Sep 17 00:00:00 2001
|
| |
+ From: Eugene Morozov <jmv@emorozov.net>
|
| |
+ Date: Mon, 13 Sep 2021 20:30:00 +0300
|
| |
+ Subject: [PATCH 4/4] Fixes #425. (#436)
|
| |
+
|
| |
+ by @emorozov
|
| |
+ ---
|
| |
+ httpretty/core.py | 6 +++---
|
| |
+ tests/functional/test_requests.py | 6 +++---
|
| |
+ 2 files changed, 6 insertions(+), 6 deletions(-)
|
| |
+
|
| |
+ diff --git a/httpretty/core.py b/httpretty/core.py
|
| |
+ index 19715e0..6968645 100644
|
| |
+ --- a/httpretty/core.py
|
| |
+ +++ b/httpretty/core.py
|
| |
+ @@ -796,7 +796,7 @@ class fakesock(object):
|
| |
+ else:
|
| |
+ self._entry.request.body += body
|
| |
+
|
| |
+ - httpretty.historify_request(headers, body, sock=self)
|
| |
+ + httpretty.historify_request(headers, body, sock=self, append=False)
|
| |
+ return
|
| |
+
|
| |
+ if path[:2] == '//':
|
| |
+ @@ -1602,7 +1602,7 @@ class httpretty(HttpBaseClass):
|
| |
+ __internals__.cleanup_sockets()
|
| |
+
|
| |
+ @classmethod
|
| |
+ - def historify_request(cls, headers, body='', sock=None):
|
| |
+ + def historify_request(cls, headers, body='', sock=None, append=True):
|
| |
+ """appends request to a list for later retrieval
|
| |
+
|
| |
+ .. testcode::
|
| |
+ @@ -1618,7 +1618,7 @@ class httpretty(HttpBaseClass):
|
| |
+ request = HTTPrettyRequest(headers, body, sock=sock)
|
| |
+ cls.last_request = request
|
| |
+
|
| |
+ - if request not in cls.latest_requests:
|
| |
+ + if append or not cls.latest_requests:
|
| |
+ cls.latest_requests.append(request)
|
| |
+ else:
|
| |
+ cls.latest_requests[-1] = request
|
| |
+ diff --git a/tests/functional/test_requests.py b/tests/functional/test_requests.py
|
| |
+ index 752428b..55aa109 100644
|
| |
+ --- a/tests/functional/test_requests.py
|
| |
+ +++ b/tests/functional/test_requests.py
|
| |
+ @@ -407,7 +407,7 @@ def test_multiline():
|
| |
+ expect(HTTPretty.last_request.body).to.equal(data)
|
| |
+ expect(HTTPretty.last_request.headers['content-length']).to.equal('37')
|
| |
+ expect(HTTPretty.last_request.headers['content-type']).to.equal('application/x-www-form-urlencoded; charset=utf-8')
|
| |
+ - expect(len(HTTPretty.latest_requests)).to.equal(2)
|
| |
+ + expect(len(HTTPretty.latest_requests)).to.equal(1)
|
| |
+
|
| |
+
|
| |
+ @httprettified
|
| |
+ @@ -431,7 +431,7 @@ def test_octet_stream():
|
| |
+ expect(HTTPretty.last_request.body).to.equal(data)
|
| |
+ expect(HTTPretty.last_request.headers['content-length']).to.equal('4')
|
| |
+ expect(HTTPretty.last_request.headers['content-type']).to.equal('application/octet-stream')
|
| |
+ - expect(len(HTTPretty.latest_requests)).to.equal(2)
|
| |
+ + expect(len(HTTPretty.latest_requests)).to.equal(1)
|
| |
+
|
| |
+
|
| |
+ @httprettified
|
| |
+ @@ -452,7 +452,7 @@ def test_multipart():
|
| |
+ expect(HTTPretty.last_request.body).to.equal(data)
|
| |
+ expect(HTTPretty.last_request.headers['content-length']).to.equal('495')
|
| |
+ expect(HTTPretty.last_request.headers['content-type']).to.equal('multipart/form-data; boundary=xXXxXXyYYzzz')
|
| |
+ - expect(len(HTTPretty.latest_requests)).to.equal(2)
|
| |
+ + expect(len(HTTPretty.latest_requests)).to.equal(1)
|
| |
+
|
| |
+
|
| |
+ @httprettified
|
| |
+ --
|
| |
+ 2.34.1
|
| |
+
|
| |
https://github.com/gabrielfalcao/HTTPretty/issues/425
Info for package maintainer
This MR has been automatically created from
this source-git MR.
Please review the contribution and once you are comfortable with the content,
you should trigger a CI pipeline run via
Pipelines → Run pipeline
.