Callback

This function allows you to specify the script to be executed after receiving the response (useful for asynchronous communication). The callback block already contains the following predefined variables:

Name
Type

http

groovyx.net.http.HTTPBuilder

version: v1.3
type: Stub
rules:
  - request:
      path: /api/callback-test
    response:
      headers:
        content-type: application/json
      body: |
        {
          "message": "Response message"
        }
    #language=Groovy    
    callback: |
        http.get(uri : 'https://httpbin.org/get', headers : ["User-Agent" : "HttpStub Bot"])

Last updated