baolsen commented on a change in pull request #6886: [AIRFLOW-6327] http_hook: 
Accept json= parameter for payload
URL: https://github.com/apache/airflow/pull/6886#discussion_r361938813
 
 

 ##########
 File path: tests/hooks/test_http_hook.py
 ##########
 @@ -334,5 +335,37 @@ def test_connection_without_host(self, 
mock_get_connection):
         hook.get_conn({})
         self.assertEqual(hook.base_url, 'http://')
 
+    @requests_mock.mock()
+    def test_post_json_request(self, mock_requests):
+        obj1 = {'a': 1, 'b': 'abc', 'c': [1, 2, {"d": 10}]}
+        obj2 = [1, 2, 3]
+
+        # Ensure that obj1 was encoded to JSON
+        def match_obj1(request):
+            return json.loads(request.text) == obj1
 
 Review comment:
   Thanks, I've changed per your suggestion.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to