Body matching oddities #162

dolzenko opened this Issue Feb 8, 2012 · 3 comments


None yet

2 participants

dolzenko commented Feb 8, 2012

So I have just discovered a few oddities in the way Webmock matches request bodies, since I have already had to delve into internals I will use internal API for demonstration too:

 > 1, b: 2).matches?({a: 1, c: nil}.to_json, 'application/json')
 => true

In other words - body matching algorithm [1] seems surprising to me, i.e. stubbed and actual bodies should have the same size, but then having different keys in stubbed and actual is accepted. If we agree that this should be changed, my proposition would be to compare actual keys, not the sizes of the both bodies.


bblimke commented Feb 8, 2012

Thanks for reporting this. It is definitely an incorrect behaviour.

bblimke commented Feb 11, 2012

Fixed in master.

@bblimke bblimke closed this Feb 11, 2012

Fantastic, thanks a lot! And for the mention too ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment