Pārlūkot izejas kodu

Merge pull request #4645 from netchampfaris/handle-json-request

Handle content_type application/json in request
version-14
Prateeksha Singh pirms 7 gadiem
committed by GitHub
vecāks
revīzija
a3669c86a5
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 8 papildinājumiem un 1 dzēšanām
  1. +8
    -1
      frappe/app.py

+ 8
- 1
frappe/app.py Parādīt failu

@@ -121,8 +121,15 @@ def init_request(request):
frappe.local.http_request = frappe.auth.HTTPRequest()

def make_form_dict(request):
import json

if request.content_type == 'application/json':
args = json.loads(request.data)
else:
args = request.form or request.args

frappe.local.form_dict = frappe._dict({ k:v[0] if isinstance(v, (list, tuple)) else v \
for k, v in iteritems(request.form or request.args) })
for k, v in iteritems(args) })

if "_" in frappe.local.form_dict:
# _ is passed by $.ajax so that the request is not cached by the browser. So, remove _ from form_dict


Notiek ielāde…
Atcelt
Saglabāt