Open Vladzimir opened 4 years ago
Hmm... well, that's not a valid regex, but maybe you've already escaped it and GitHub just isn't checking properly?
This: settings.url.match(//restful/(.*)$/);
should probably be: settings.url.match(/\/restful\/(.*)$/);
I'll have to write a little test to see if I can replicate this.
$.mockjax(function(settings) {
// settings.url might be: "/restful/" such as "/restful/user"
var service = settings.url.match(/\/restful\/(.*)$/); if ( service ) { return { proxy: "/mocks/" + service[1] + ".json" }; } // If you get here, there was no url match return; });
Using this method fails to redirect POST data to proxy url Have to use crutches
proxyType: settings.type, data: settings.data, headers: settings.headers, contentType: settings.contentType