hoverfly icon indicating copy to clipboard operation
hoverfly copied to clipboard

Hoverfly does not match on scheme

Open mogronalol opened this issue 7 years ago • 9 comments

Currently, the scheme field is ignored by matchers. It should be matched on like the remaining fields.

mogronalol avatar Jun 06 '17 09:06 mogronalol

It's not satisfactory but we would like to know if this impacts anybody else as we fear fixing it could affect many existing simulations

JohnFDavenport avatar Nov 23 '18 11:11 JohnFDavenport

Should this be added while we're at v6? dropping the scheme from matchers when simulation's version is lower than v6 (printing a warning if scheme is provided) and keeping it for v6+? @tommysitu

ns3777k avatar May 04 '20 09:05 ns3777k

@ns3777k don't worry about this one, it's really non-essential.

tommysitu avatar May 07 '20 19:05 tommysitu

I have a similar issue, but with the query field. On one pair object I have this:

"request" : {
...
          "query": {
            "account_numbers": [
              {
                "matcher": "exact",
                "value": "ACC001"
              }
            ]
          }
...
}

And in another Pair, the following:

"request" : {
...
          "query": {
            "account_numbers": [
              {
                "matcher": "exact",
                "value": "ACC002"
              },
              {
                "matcher": "exact",
                "value": "ACC003"
              }
            ]
          }
...
}

No matter what query parameters are used in the request, it always matches the first pair, I can also change the order and will retrieve whichever was set as the first pair.

So both: http://url/endpoint/?account_numbers=ACC001 or http://url/endpoint/?account_numbers=ACC002&account_numbers=ACC003

will retrieve the same response.

Additional info: I'm using 1.3.1 (currently Stable)

This is prompted when running the proxy:

Hoverfly has been set to simulate mode with a matching strategy of 'strongest'
WARNING: data.pairs[1] is not added due to a conflict with the existing simulation

Note: The only difference between the pairs is the query field.

juan-ignacio-sanchez avatar Sep 25 '20 19:09 juan-ignacio-sanchez

Hi @jiss2891, for query params with multiple values, the current way to do it is this:

"request" : {
...
          "query": {
            "account_numbers": [
              {
                "matcher": "exact",
                "value": "ACC002;ACC003"
              }
            ]
          }
...
}

tommysitu avatar Sep 27 '20 14:09 tommysitu

Thanks for answer me. I'll try this!

juan-ignacio-sanchez avatar Sep 28 '20 00:09 juan-ignacio-sanchez

Still getting this:

WARNING: data.pairs[1] is not added due to a conflict with the existing simulation

I think that the query field is not being considered to differentiate two pairs from each other and that produces a conflict.

If I modify any attr, for example: destination this warning will not be prompted. If I change the query attribute from account_numbers to this_should_be_different (only on one pair...) the warning still prompts up.

juan-ignacio-sanchez avatar Sep 28 '20 17:09 juan-ignacio-sanchez

Hey @jiss2891, I can't reproduce the issue. can you join Gitter https://gitter.im/SpectoLabs/hoverfly please? we can discuss there.

tommysitu avatar Sep 28 '20 18:09 tommysitu

Just left a comment there.

juan-ignacio-sanchez avatar Sep 28 '20 18:09 juan-ignacio-sanchez