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

Request match ignoring queryStringParameters #192

Open
eduardodbr opened this issue Nov 1, 2024 · 0 comments
Open

Request match ignoring queryStringParameters #192

eduardodbr opened this issue Nov 1, 2024 · 0 comments

Comments

@eduardodbr
Copy link

Hi,

It seems that the request parameter queryStringParameters is being ignored when trying to find a match. Steps to reproduce:

Create a file foo.yaml:

---
request:
  method: GET
  path: /api/v1/foo
  queryStringParameters:
    limit:
      - 1
    offset:
      - 0
response:
  statusCode: 200
  headers:
    Content-Type:
      - "application/json"
  body: >
    {
      "bar":"baz"
    }

create a second file foo2.yaml:

---
request:
  method: GET
  path: /api/v1/foo
  queryStringParameters:
    limit:
      - 1
    offset:
      - 50
response:
  statusCode: 200
  headers:
    Content-Type:
      - "application/json"
  body: >
    {
      "fooBar": "barBar"
    }

launch the docker using those files as config:

docker run -v <path>/config:/config -p 8082:8082 -p 8083:8083 jordimartin/mmock

test it with curl multiple times:

curl -X 'GET' http://localhost:8083/api/v1/foo\?limit=1\&offset=50

Response:

{
  "bar":"baz"
}

curl -X 'GET' http://localhost:8083/api/v1/foo\?limit=1\&offset=50

Response:

{
  "fooBar": "barBar"
}

container logs:

17:32:58.622 INFO ▶ New request: GET /api/v1/foo?limit=1&offset=50
17:32:58.627 INFO ▶ Definition match found: true. Name : foo.yaml
17:33:00.429 INFO ▶ New request: GET /api/v1/foo?limit=1&offset=50
17:33:00.430 INFO ▶ Definition match found: true. Name : foo2.yaml

I also tried to update the field queryStringParameters to use array of strings as seen in some examples:

queryStringParameters: {
    "limit": ["1"],
    "offset": ["50"]
  }

Is there something wrong with the configs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant