Skip to content

Functional Fuzzer query parameters for methods with Body #186

@sauvainr

Description

@sauvainr

Describe the bug
Functional fuzzer query parameters are not working when the method has a request body: PUT, POST, PATCH.
Non-body methods works fine (GET, DEL). (And so do path parameters).

Maybe related to #176 ?

To Reproduce

API:

paths:
  run:
    parameters:
      - in: query
        name: myparam
        required: true
        type: string
    get:
      responses:
        '200':
          description: Successful response.
          schema:
            $ref: '#/definitions/RunResult'
    post:
      responses:
        '200':
          description: Successful response.
          schema:
            $ref: '#/definitions/RunResult'
    put:
      responses:
        '200':
          description: Successful response.
          schema:
            $ref: '#/definitions/RunResult'
    patch:
      responses:
        '200':
          description: Successful response.
          schema:
            $ref: '#/definitions/RunResult'
    delete:
      responses:
        '200':
          description: Successful response.
          schema:
            $ref: '#/definitions/RunResult'

Functional fuzzer:

run:
  postRun:
    httpMethod: POST
    description: POST
    schemaPath: myValue
    expectedResponseCode:
      - '200'
  putRun:
    httpMethod: PUT
    description: PUT
    schemaPath: myValue
    expectedResponseCode:
      - '200'
  patchRun:
    httpMethod: PATCH
    description: PATCH
    schemaPath: myValue
    expectedResponseCode:
      - '200'
  delRun:
    httpMethod: DELETE
    description: DELETE
    schemaPath: myValue
    expectedResponseCode:
      - '200'
  getRun:
    httpMethod: GET
    description: GET
    schemaPath: myValue
    expectedResponseCode:
      - '200'

Run it without much customization:

./bin/cats run ./funcFuzzer.yml -c=./swagger.yml -s=http://localhost:3000

Outcome of basic endpoints with console.log(req.method, req.url);

DELETE /run?schemaPath=myValue
GET /run?schemaPath=myValue
PATCH /run
POST /run
PUT /run

Now I found a way to force query parameters with '--queryParams'

./bin/cats run ./funcFuzzer.yml -c=./swagger.yml -s=http://localhost:3000 --queryParams=./query_params.yaml

With content:

all:
    schemaPath: allValue
run:
    schemaPath: runPathValue

Gives me:

DELETE /run?schemaPath=myValue&schemaPath=runPathValue
GET /run?schemaPath=myValue&schemaPath=runPathValue
PATCH /run?schemaPath=runPathValue
POST /run?schemaPath=runPathValue
PUT /run?schemaPath=runPathValue

As we can see it does add the parameters however it duplicates them for the GET & DELETE methods.

So it seems I have no work around this issue and help would be great!

Suggestions :

  1. Obviously support the query parameters in the func Fuzzer
  2. The queryParams shouldnt add an additional value. It should set a default.

Additional context
Version tested both 13.2.0 & 13.4.3 with same behavior.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions