Use this response type and return it
from werkzeug.wrappers import Response
from frappe.utils import response as r
Don’t return simply a dict
If the above documentation is not working try this:
import frappe
from frappe.utils import response
@frappe.whitelist(allow_guest=True)
def get_item_details(item=None):
Item = frappe.db.sql("select * from tabItem", as_dict=True )
response['http_status_code'] = 200
response['data'] = Item
return
Note: If its not working add method type and hit with respective method like this
@frappe.whitelist(allow_guest=True, method='POST')