You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For my HTTP client I now have the need to assert that repeated headers are being sent or not with the correct values and number of times. For example, I kind of expected the following to work:
let m = mock("GET","/").match_header("x-header","some-value1").match_header("x-header","some-value2").create();
I want to assert that x-header is present twice in the request, one with the value some-value1 and another with the value some-value2. After looking at the source, I now understand that this will never match anything because instead two matchers are created, both expecting all occurrences of x-header to be equal to the respective values. (Incidentally, seems the error diff is a bit bugged in this scenario and points to the wrong header, but I need to poke around that further.)
I don't currently see a way of asserting what I want to assert, though I do see that internally matchers are given all header values as a slice. I guess this is a feature request then for some sort of matcher that contains a list of matchers, but unlike Matcher::AllOf, requires that each matcher in the list matches a header value uniquely exactly once.
I'd be willing to implement this if this sounds like something you'd be willing to accept.
The text was updated successfully, but these errors were encountered:
For my HTTP client I now have the need to assert that repeated headers are being sent or not with the correct values and number of times. For example, I kind of expected the following to work:
I want to assert that
x-header
is present twice in the request, one with the valuesome-value1
and another with the valuesome-value2
. After looking at the source, I now understand that this will never match anything because instead two matchers are created, both expecting all occurrences ofx-header
to be equal to the respective values. (Incidentally, seems the error diff is a bit bugged in this scenario and points to the wrong header, but I need to poke around that further.)I don't currently see a way of asserting what I want to assert, though I do see that internally matchers are given all header values as a slice. I guess this is a feature request then for some sort of matcher that contains a list of matchers, but unlike
Matcher::AllOf
, requires that each matcher in the list matches a header value uniquely exactly once.I'd be willing to implement this if this sounds like something you'd be willing to accept.
The text was updated successfully, but these errors were encountered: