fix: Make requests with cmd on /api/method/path

- Will help in better debugging and Cypress testing
This commit is contained in:
Faris Ansari 2019-02-13 16:04:06 +05:30
parent 17b20b22a3
commit 0dbafb9c6b
3 changed files with 10 additions and 1 deletions

View file

@ -28,6 +28,8 @@ def get_form_params():
data = frappe._dict(frappe.local.form_dict)
del data["cmd"]
del data["data"]
if "csrf_token" in data:
del data["csrf_token"]

View file

@ -747,6 +747,7 @@ def get_list(doctype, *args, **kwargs):
'''wrapper for DatabaseQuery'''
kwargs.pop('cmd', None)
kwargs.pop('ignore_permissions', None)
kwargs.pop('data', None)
# If doctype is child table
if frappe.is_table(doctype):

View file

@ -75,6 +75,12 @@ frappe.call = function(opts) {
}
}
let url = opts.url;
if (!url) {
url = '/api/method/' + args.cmd;
delete args.cmd;
}
return frappe.request.call({
type: opts.type || "POST",
args: args,
@ -87,7 +93,7 @@ frappe.call = function(opts) {
headers: opts.headers || {},
// show_spinner: !opts.no_spinner,
async: opts.async,
url: opts.url || frappe.request.url,
url,
});
}