From 833dee4415facf6e2f0580057fcb7a6adfdd8dac Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Mon, 27 Nov 2023 17:24:29 +0530 Subject: [PATCH] feat: add application/json support for client --- twilio/http/http_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py index bfc38feaf..a3505ca8a 100644 --- a/twilio/http/http_client.py +++ b/twilio/http/http_client.py @@ -79,12 +79,16 @@ def request( "method": method.upper(), "url": url, "params": params, - "data": data, "headers": headers, "auth": auth, "hooks": self.request_hooks, } + if headers is not None and 'Content-Type' in headers.keys() and headers['Content-Type'] == 'application/json': + kwargs['json'] = data + else: + kwargs['data'] = data + self.log_request(kwargs) self._test_only_last_response = None