Skip to content

Request match ignoring queryStringParameters #192

@eduardodbr

Description

@eduardodbr

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions