Camouflage is a backend mocking tool for HTTP, gRPC, Websockets and Thrift protocols, which helps you carry out your front end prototyping, unit testing, functional/performance testing in silos, in absence of one or more Microservices/APIs.
Is your feature request related to a problem? Please describe.
Though with handlebars, user has an extensive capability to write conditions, run loops etc without writing a code, there might be some complex use cases where the user would need to write a custom code to generate a desired response.
Describe the solution you'd like
This can be implemented using a custom handlebar helper which can evaluate the code passed in via mock files and generate a desired response. Final implementation could look like following in a mock file:
HTTP/1.1 200 OK
X-Static-Header: Static-Value
{{code}}
function (request, logger) {
var name = request.query.name;
return {
status: 201,
headers: {
"X-Dynamic-Header": "Dynamic-Value"
},
body: `{'greeting': 'Hello ${name}'}`
}
}
{{/code}}
Is your feature request related to a problem? Please describe. Though with handlebars, user has an extensive capability to write conditions, run loops etc without writing a code, there might be some complex use cases where the user would need to write a custom code to generate a desired response.
Describe the solution you'd like This can be implemented using a custom handlebar helper which can evaluate the code passed in via mock files and generate a desired response. Final implementation could look like following in a mock file:
Describe alternatives you've considered NA
Additional context NA