Closed vinothwindows47 closed 6 years ago
The proxyType
refers to how the proxy file will be retrieved, NOT how the mock will be matched. Your two mockjax handlers are for the same request. I think what you probably want is just type
, the default for how to retrieve the proxy file is "GET"... which is almost always what you want. Change your code to this:
$.mockjax({
url: '/*/portal/hcl/api/v1/projects',
type: "GET",
proxy: "mocks/projects/list.json"
});
$.mockjax({
url: '/*/portal/hcl/api/v1/projects',
type: "POST",
proxy: "mocks/projects/create.json"
});
Thank you very much
@jakerella
How do you pass parameter in URL ?
URL : /*/portal/hcl/api/v1/projects?type=git&page=1
$.mockjax({ url: '/*/portal/hcl/api/v1/projects', urlParams: ["type", "page"], type: "GET", proxy: "mocks/projects/list.json" });
Just like you have it. This seems to be a different issue, so I'm going to close this issue. If you have questions you may want to try StackOverflow, but if you find a bug please post again!
When I use post "/projects" URL , always proxy takes "mocks/projects/list.json" files. What can I do for it . @bantic @neonux @mlynch @kesselborn @malsup