zot24
1/1/2017 - 12:26 PM

Inject JSON file as a body of a response with mountbank

Inject JSON file as a body of a response with mountbank

function (request, state, logger) {
  return {
    headers: {
      'Content-Type': 'application/json'
    },
    body: '<%- stringify(filename, 'services/settings/body.ejs') %>'
  };
}
{
  "imposters": [
    <% include services/settings/data.ejs %>
  ]
}
{
  "protocol": "http",
  "port": 4542,
  "requests": [],
  "name": "settings",
  "stubs": [
    {
      "responses": [
        {
          "inject": "<%- stringify(filename, 'services/settings/response.ejs') %>"
        }
      ]
    }
  ]
}
{
   "data":{
      "type":"settings",
      "page_length":100,
      "email_smtp_port":25,
      "email_encryption":"none",
      "timezone":"UTC",
      "password_policy":"min_6_letters"
   }
}