Closed fatihtekin closed 9 years ago
It is not possible to do this with Javascript without first writing a Java class.
However if you have already written a Java class and you have added this class to the classpath of the JVM running the Mock Server then you can submit an expectation in JavaScript as follows:
mockServerClient("localhost", 1080).mockAnyResponse(
{
'httpRequest': {
'method': 'POST',
'path': '/somePath'
},
'httpCallback': {
'callbackClass' : 'com.some.package.MyCallbackAction'
},
'times': {
'remainingTimes': 1,
'unlimited': false
}
}
);
Given the solution for #120 will use WebSockets it should be possible to support function based callbacks for JavaScript. I'll add a comment to that ticket so that it included. This would dramatically improve the JavaScript experience for callback logic. This however is not likely to be completed for roughly 4-6 weeks.
Regarding https://github.com/jamesdbloom/mockserver/issues/158 can you provide java script code for callback