dstandish 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_r361253921
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -123,6 +127,7 @@ def run(self, endpoint, data=None, headers=None, 
extra_options=None):
             req = requests.Request(self.method,
                                    url,
                                    data=data,
+                                   json=json,
 
 Review comment:
   i see you are only adding `json` for requests other than GET or HEAD
   
   i know that presently the hook conditionally forwards the `data` param --  
in one case to `params`, in another to `data`.  but this seems like a mistake.  
   
   since `json` is brand new param, why not pass it on in all cases, no matter 
the request type?
   
   at least, the docstring should probably disclose that `json` is only 
forwarded for non-GET and non-HEAD requests, if there is a legitimate reason to 
forward it selectively.  and perhaps raise an error if it is supplied and you 
will not forward it.

----------------------------------------------------------------
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