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 2018/12/17 23:52:51 UTC
[GitHub] stale[bot] closed pull request #2881: Correct http_hook to use
conn_type instead of schema
stale[bot] closed pull request #2881: Correct http_hook to use conn_type instead of schema
URL: https://github.com/apache/incubator-airflow/pull/2881
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/airflow/hooks/http_hook.py b/airflow/hooks/http_hook.py
index b8075a04a9..6db94e26d5 100644
--- a/airflow/hooks/http_hook.py
+++ b/airflow/hooks/http_hook.py
@@ -41,8 +41,8 @@ def get_conn(self, headers):
self.base_url = conn.host
else:
# schema defaults to HTTP
- schema = conn.schema if conn.schema else "http"
- self.base_url = schema + "://" + conn.host
+ conn_type = conn.conn_type if conn.conn_type else "http"
+ self.base_url = conn_type + "://" + conn.host
if conn.port:
self.base_url = self.base_url + ":" + str(conn.port) + "/"
diff --git a/tests/core.py b/tests/core.py
index a57f0ede60..51e141692b 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -2360,7 +2360,7 @@ def test_http_connection(self, mock_get_connection):
@mock.patch('airflow.hooks.http_hook.HttpHook.get_connection')
def test_https_connection(self, mock_get_connection):
- c = models.Connection(conn_id='http_default', conn_type='http',
+ c = models.Connection(conn_id='http_default', conn_type='https',
host='localhost', schema='https')
mock_get_connection.return_value = c
hook = HttpHook()
@@ -2378,7 +2378,7 @@ def test_host_encoded_http_connection(self, mock_get_connection):
@mock.patch('airflow.hooks.http_hook.HttpHook.get_connection')
def test_host_encoded_https_connection(self, mock_get_connection):
- c = models.Connection(conn_id='http_default', conn_type='http',
+ c = models.Connection(conn_id='http_default', conn_type='https',
host='https://localhost')
mock_get_connection.return_value = c
hook = HttpHook()
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
With regards,
Apache Git Services