Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow matching feature to match exact query params #45

Open
flaviomeira opened this issue Dec 30, 2019 · 0 comments
Open

Allow matching feature to match exact query params #45

flaviomeira opened this issue Dec 30, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@flaviomeira
Copy link
Collaborator

When a session with 2 objects is activated, and this 2 objects have different params, Tshield always returns the first object.

I'd like to get the object which has more matches. In the following example Tshield always returns the first object of the matching session, while the second object has more params to match.

Scenario: Return correct answer for same path with different params
    Given a file to describe "/path/1" path
    And in session "multiples-responses-with-different-params"
    When this api is accessed throught tshield with params
    And this api is accessed throught tshield with params
      | key | value |
      | param1 | param1_value |
      | param2 | param2_value |
      | param3 | param3_value |
    Then response should be equal "request called with 3 params"

The 'multiples-responses-with-different-params' session has 2 objects:

[
  {
    "session": "multiples-responses-with-different-params",
    "stubs": [
      {
        "method": "GET",
        "path": "/path/1",
        "query": {
          "param1": "param1_value",
          "param2": "param2_value"
        },

        "response": {
          "status": 200,
          "headers": {
            "content-type": "application/json;charset=UTF-8"
          },
          "body": "request called with 2 params"
        }
      },


      {
        "method": "GET",
        "path": "/path/1",
        "query": {
          "param1": "param1_value",
          "param2": "param2_value",
          "param3": "param3_value"
        },

        "response": {
          "status": 200,
          "headers": {
            "content-type": "application/json;charset=UTF-8"
          },
          "body": "request called with 3 params"
        }
      }
    ]}
]
@flaviomeira flaviomeira added the enhancement New feature or request label Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant