imposter icon indicating copy to clipboard operation
imposter copied to clipboard

docs: improve description of steps

Open outofcoffee opened this issue 2 years ago • 1 comments
trafficstars

Supported step types:

Type Purpose
remote Make an HTTP(S) call to an endpoint
script Execute a script file

Remote example:

plugin: rest

resources:
  # example setting query param, headers and content
  - path: /example1
    method: GET
    steps:
      - type: remote
        url: http://localhost:8081
        method: POST
        queryParams:
          petId: "${context.request.queryParams.petId}"
        headers:
          X-Test-Header: "test"
        content: '{ "type": "cat" }'
    response:
      content: "Request sent"

  # example with capture
  - path: /example2
    method: GET
    steps:
      - type: remote
        url: http://localhost:8081
        method: GET
        capture:
          petName:
            store: request
            expression: "${remote.response.body}"
          statusCode:
            store: request
            expression: "${remote.response.statusCode}"
    response:
      content: "${stores.request.petName}"
      template: true

Script example:

plugin: rest

resources:
  - path: /example
    method: GET
    steps:
      - type: script
        file: test.js
    response:
      content: "${stores.request.foo}"
      template: true

outofcoffee avatar Aug 02 '23 12:08 outofcoffee

WIP on docs/steps

outofcoffee avatar Nov 09 '23 20:11 outofcoffee