I thought this is for the entire response. I can’t figure out what needs to be done if only 1 field is NOT using dynamic value and the rest is dynamic.
I have a similar requirement in which I want to set a response field to some specific input value based on a mock expectation, not always set for all request. Is it possible to achieve scripts based on mock expectations?
// Get mock data from Smart Mock
var responseJson = $$.mockResponse.json();
// Modify the paged data from responseJson
// Set page as the page in request parameter
responseJson.page = $$.mockRequest.getParam(“page”);
// Write the modified json into $$.mockResponse
$$.mockResponse.setBody(responseJson);
But this will update for all requests, irrespective of any mock expectation. e.g. I have 2 mock expectations like if the body parameter has text “QA” i need to make the response id as input body parameter “Id” else response id should be input body parameter “returnId”
I am very excited to play around with Apidog with the various features.
I will definitely recommend APIdog to my colleagues once I am more familiar with Apidog
Please see a simple example screenshots below.
Screenshot 1) = mock script
Screenshot 2) = error faced
Screenshot 3) Endpoint response details.
Can you advise what the issue is?