Skip to content

Commit

Permalink
feat: add upstream json argument to integrations make_request (#22462)
Browse files Browse the repository at this point in the history
* feat: add upstream json argument to integrations make_request

* style: format

[skip ci]

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 086435c)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
  • Loading branch information
2 people authored and akhilnarang committed Apr 9, 2024
1 parent ef5fec3 commit 46a396e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frappe/integrations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
from frappe.utils import get_request_session


def make_request(method, url, auth=None, headers=None, data=None):
def make_request(method, url, auth=None, headers=None, data=None, json=None):
auth = auth or ""
data = data or {}
headers = headers or {}

try:
s = get_request_session()
frappe.flags.integration_request = s.request(method, url, data=data, auth=auth, headers=headers)
frappe.flags.integration_request = s.request(
method, url, data=data, auth=auth, headers=headers, json=json
)
frappe.flags.integration_request.raise_for_status()

if frappe.flags.integration_request.headers.get("content-type") == "text/plain; charset=utf-8":
Expand Down

0 comments on commit 46a396e

Please sign in to comment.