Closed GiritharanR closed 6 years ago
@jamesdbloom - Could you please guide me on this?
The client returns promises so the following code should fix your issue:
var mockServer = require('mockserver-client'),
mockServerClient = mockServer.mockServerClient;
var path = '/somePathOne';
var client = mockServerClient("localhost", 9000);
client.mockSimpleResponse(path, {name: 'one'}, 201)
.then(function () {
client.mockSimpleResponse('/somePathTwo', {name: 'two'}, 202)
.then(function () {
client.retrieveExpectations(path).then(
function (expectations) {
console.log(expectations);
},
function (error) {
console.log("Error retrieving expectations " + error);
}
);
}, function (error) {
console.log("Error creating /somePathTwo " + error);
}
);
},
function () {
console.log("Error creating " + path + " " + error);
}
);
Please try this and re-open the issue if it is not working for you.
I have created the grunt task to set an expectations and tried to retrieve the same.
but it is not returning the expectations matched for the path. instead it is always returned as below
I have verified in the mockserver.log after made the expectations. Expectations can be found at mockserver log, but it is not returning while calling with
retrieveExpectations
.mockserver.txt
Advice me how to retrieve expectations with in javascript. I have tried
retrieveExpectations
for all too. Still the same. For me, it looks likeretrieveExpectations
didn't made contact at all.