sd274 opened a new issue, #24325:
URL: https://github.com/apache/airflow/issues/24325

   ### Apache Airflow version
   
   2.3.0
   
   ### What happened
   
   I'm trying to create a dag that uses the `SimpleHttpOperator` to post data 
to various endpoints and pass the responses to other endpoints. As I am passing 
the responses to other endpoints it is convenient to have 
`render_template_as_native_obj=True`. However, when I have this set to True it 
seems to cause issues with the data that is posted. Example below (works when 
`render_template_as_native_obj=False`) the http_conn_id is set up with 
`https://jsonplaceholder.typicode.com/`):
   
   ```
   from datetime import datetime
   import yaml
   
   from airflow import DAG
   from airflow.operators.bash import BashOperator
   from airflow.providers.http.operators.http import SimpleHttpOperator
   from airflow.decorators import dag, task
   
   dag_id = f'http_test'
   @dag(dag_id=dag_id, start_date=datetime(2022, 6,7), 
render_template_as_native_obj=True)
   def http_test():
   
       first_task = BashOperator(
           task_id='first_task',
           bash_command='echo helllo',
       )
   
       get_some_data_task = SimpleHttpOperator(
           task_id='get_some_data',
           method='POST',
           endpoint='/posts',
           http_conn_id='jsonplaceholder',
           headers={"Content-Type": "application/json"},
           data=json.dumps({
               'title': 'foo',
               'body': 'bar',
               'userId': 1,
           }),
       )
   
       first_task >> get_some_data_task
   
   dag = http_test()
   ```
   
   ### What you think should happen instead
   
   Having `render_template_as_native_obj` should only effect jinja templates, 
not other parts of the code.
   
   ### How to reproduce
   
   Dag defined above works with `render_template_as_native_obj` as False, but 
fails with it as True.
   
   ### Operating System
   
   mac-os
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon @ 
file:///pip-packages/apache_airflow_providers_amazon-3.4.0-py3-none-any.whl
   apache-airflow-providers-celery==2.1.0
   apache-airflow-providers-cncf-kubernetes==2.1.0
   apache-airflow-providers-docker==2.3.0
   apache-airflow-providers-elasticsearch==2.1.0
   apache-airflow-providers-ftp @ 
file:///pip-packages/apache_airflow_providers_ftp-2.1.2-py3-none-any.whl
   apache-airflow-providers-google==6.1.0
   apache-airflow-providers-grpc==2.0.1
   apache-airflow-providers-hashicorp==2.1.1
   apache-airflow-providers-http @ 
file:///pip-packages/apache_airflow_providers_http-2.1.2-py3-none-any.whl
   apache-airflow-providers-imap @ 
file:///pip-packages/apache_airflow_providers_imap-2.2.3-py3-none-any.whl
   apache-airflow-providers-microsoft-azure==3.3.0
   apache-airflow-providers-mysql==2.1.1
   apache-airflow-providers-odbc==2.0.1
   apache-airflow-providers-postgres==2.3.0
   apache-airflow-providers-redis==2.0.1
   apache-airflow-providers-sendgrid==2.0.1
   apache-airflow-providers-sftp==2.2.0
   apache-airflow-providers-slack==4.1.0
   apache-airflow-providers-snowflake @ 
file:///pip-packages/apache_airflow_providers_snowflake-2.7.0-py3-none-any.whl
   apache-airflow-providers-sqlite @ 
file:///pip-packages/apache_airflow_providers_sqlite-2.1.3-py3-none-any.whl
   apache-airflow-providers-ssh==2.3.0
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to