fix query param matching

Signed-off-by: zhang-liang-pengkun <zhangliangpengkun@xfusion.com>
This commit is contained in:
zhang-liang-pengkun 2023-11-16 11:51:20 +08:00
parent e490baaea7
commit df4ca79d40
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 946b0613ac40d26713031053028a16da1f6c26f0 Mon Sep 17 00:00:00 2001
From: Dave Trollope <dave@knowledgehound.com>
Date: Fri, 7 Sep 2018 14:35:10 -0500
Subject: [PATCH] fix query param matching
---
httpretty/core.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/httpretty/core.py b/httpretty/core.py
index 92dd8a9..8da3428 100644
--- a/httpretty/core.py
+++ b/httpretty/core.py
@@ -991,7 +991,8 @@ class URIMatcher(object):
def matches(self, info):
if self.info:
- return self.info == info
+ # Query string is not considered when comparing info objects, compare separately
+ return self.info == info and (not self._match_querystring or self.info.query == info.query)
else:
return self.regex.search(info.full_url(
use_querystring=self._match_querystring))
--
2.39.0.windows.2

View File

@ -1,6 +1,6 @@
Name: python-httpretty
Version: 0.9.5
Release: 5
Release: 6
Summary: HTTP Client mocking tool for Python
License: MIT
URL: https://pypi.org/project/httpretty/
@ -10,6 +10,7 @@ Patch0001: python-httpretty-fakesock_getpeercert_noconnect.patch
Patch0002: 0001-Handle-bugs-in-older-urllib3-versions-in-one-of-the-.patch
Patch0003: 0001-Call-reset-from-setUp-and-tearDown-in-addition-to-en.patch
Patch0004: Mock-time-to-make-date-based-tests-reliable.patch
Patch0005: 0002-fix-query-param-matching.patch
BuildRequires: python2-devel python2-setuptools python2-httplib2 python2-mock python2-nose
BuildRequires: python2-requests python2-sure python2-urllib3 python2-tornado python-unittest2
@ -69,6 +70,9 @@ LANG=en_US.UTF-8 %{__python3} -m nose2 -v
%{python3_sitelib}/httpretty-%{version}-py3.?.egg-info
%changelog
* Thu Nov 16 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.9.5-6
- fix query param matching
* Fri Dec 30 2022 yaoxin <yaoxin30@h-partners.com> - 0.9.5-5
- Fix occasional failures in check stage