Skip to content

Commit

Permalink
[AIRFLOW-5766] Use httpbin.org in http_default (#6438)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingrammer authored and kaxil committed Dec 17, 2019
1 parent 039fd62 commit f279c91
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions airflow/example_dags/example_http_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
# t1, t2 and t3 are examples of tasks created by instantiating operators
t1 = SimpleHttpOperator(
task_id='post_op',
endpoint='api/v1.0/nodes',
endpoint='post',
data=json.dumps({"priority": 5}),
headers={"Content-Type": "application/json"},
response_check=lambda response: True if len(response.json()) == 0 else False,
response_check=lambda response: response.json()['json']['priority'] == 5,
dag=dag,
)

t5 = SimpleHttpOperator(
task_id='post_op_formenc',
endpoint='nodes/url',
endpoint='post',
data="name=Joe",
headers={"Content-Type": "application/x-www-form-urlencoded"},
dag=dag,
Expand All @@ -63,7 +63,7 @@
t2 = SimpleHttpOperator(
task_id='get_op',
method='GET',
endpoint='api/v1.0/nodes',
endpoint='get',
data={"param1": "value1", "param2": "value2"},
headers={},
dag=dag,
Expand All @@ -72,7 +72,7 @@
t3 = SimpleHttpOperator(
task_id='put_op',
method='PUT',
endpoint='api/v1.0/nodes',
endpoint='put',
data=json.dumps({"priority": 5}),
headers={"Content-Type": "application/json"},
dag=dag,
Expand All @@ -81,7 +81,7 @@
t4 = SimpleHttpOperator(
task_id='del_op',
method='DELETE',
endpoint='api/v1.0/nodes',
endpoint='delete',
data="some=data",
headers={"Content-Type": "application/x-www-form-urlencoded"},
dag=dag,
Expand All @@ -92,7 +92,7 @@
http_conn_id='http_default',
endpoint='',
request_params={},
response_check=lambda response: True if "Google" in response.text else False,
response_check=lambda response: "httpbin" in response.text,
poke_interval=5,
dag=dag,
)
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def initdb(rbac=False):
merge_conn(
Connection(
conn_id='http_default', conn_type='http',
host='https://www.google.com/'))
host='https://www.httpbin.org/'))
merge_conn(
Connection(
conn_id='mssql_default', conn_type='mssql',
Expand Down
2 changes: 1 addition & 1 deletion tests/sensors/test_http_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def resp_check(resp):

prep_request = requests.Request(
'HEAD',
'https://www.google.com',
'https://www.httpbin.org',
{}).prepare()

self.assertEqual(prep_request.url, received_request.url)
Expand Down

0 comments on commit f279c91

Please sign in to comment.