Show More
@@ -144,9 +144,21 b' def vcrcommand(name, flags, spec, helpca' | |||||
144 | def hgmatcher(r1, r2): |
|
144 | def hgmatcher(r1, r2): | |
145 | if r1.uri != r2.uri or r1.method != r2.method: |
|
145 | if r1.uri != r2.uri or r1.method != r2.method: | |
146 | return False |
|
146 | return False | |
147 |
r1params = r1.body |
|
147 | r1params = util.urlreq.parseqs(r1.body) | |
148 |
r2params = r2.body |
|
148 | r2params = util.urlreq.parseqs(r2.body) | |
149 | return set(r1params) == set(r2params) |
|
149 | for key in r1params: | |
|
150 | if key not in r2params: | |||
|
151 | return False | |||
|
152 | value = r1params[key][0] | |||
|
153 | # we want to compare json payloads without worrying about ordering | |||
|
154 | if value.startswith(b'{') and value.endswith(b'}'): | |||
|
155 | r1json = json.loads(value) | |||
|
156 | r2json = json.loads(r2params[key][0]) | |||
|
157 | if r1json != r2json: | |||
|
158 | return False | |||
|
159 | elif r2params[key][0] != value: | |||
|
160 | return False | |||
|
161 | return True | |||
150 |
|
162 | |||
151 | def sanitiserequest(request): |
|
163 | def sanitiserequest(request): | |
152 | request.body = re.sub( |
|
164 | request.body = re.sub( |
General Comments 0
You need to be logged in to leave comments.
Login now