mountebank icon indicating copy to clipboard operation
mountebank copied to clipboard

Allow SQL lookups

Open bbyars opened this issue 8 years ago • 1 comments

Like the CSV lookups, allow looking up values from SQL and replacing response tokens

bbyars avatar Mar 11 '17 23:03 bbyars

Maybe something like this:

{
  "is": {
    "statusCode": "${row}['code']",
    "headers": {
      "X-Tree": "${row}['tree']"
    },
    "body": "Hello ${row}['Name'], have you done your ${row}['jobs'] today?"
  },
  "_behaviors": {
    "lookup": [{
       "key": {
        "from": "path",
        "using": { "method": "regex", "selector": "/(.*)$" },
        "index": 1
      },
      "fromDataSource": {
        "sql": {
          "connectionString": "...",
          "keyColumn": "Name"
        }
      },
      "into": "${row}"
    }]
  }
 }

bbyars avatar Jun 25 '19 01:06 bbyars