You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/22 16:06:30 UTC

[GitHub] [airflow] ashb commented on a change in pull request #14701: HttpHook. Use request factory and respect defaults

ashb commented on a change in pull request #14701:
URL: https://github.com/apache/airflow/pull/14701#discussion_r618537627



##########
File path: airflow/providers/http/hooks/http.py
##########
@@ -126,15 +126,20 @@ def run(
         else:
             url = (self.base_url or '') + (endpoint or '')
 
+        request_parameters = dict(method=self.method.upper(), url=url, headers=headers)
+        request_parameters.update(request_kwargs)
+
         if self.method == 'GET':
             # GET uses params
-            req = requests.Request(self.method, url, params=data, headers=headers, **request_kwargs)
+            request_parameters["params"] = data
         elif self.method == 'HEAD':
             # HEAD doesn't use params
-            req = requests.Request(self.method, url, headers=headers, **request_kwargs)
+            pass
         else:
             # Others use data
-            req = requests.Request(self.method, url, data=data, headers=headers, **request_kwargs)
+            request_parameters["data"] = data
+
+        req = requests.Request(**request_parameters)

Review comment:
       This block appears to change the code to have no difference in behaviour, unless I've missed something
   
   Can you remove hunk please?




-- 
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:
users@infra.apache.org