[ 
https://issues.apache.org/jira/browse/AIRFLOW-3162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Chang updated AIRFLOW-3162:
--------------------------------
    Description: 
https://github.com/apache/incubator-airflow/pull/3379 introduced a regression 
on HttpHook.get() where if a port is specified on 
airflow.models.Connection.port and the provided endpoint has no leading slash, 
the URL will fail to parse.

With the connection:

 
 {{airflow.models.Connection(}}
 {{    conn_id='test_conn',}}
 {{    conn_type='http',}}
 {{    host='test.com',}}
 {{    port=1234}}
 {{)}}
 {{>>> hook = HttpHook(method='GET', http_conn_id='test_conn')}}

{{>>> hook.get(endpoint='some/endpoint')}}

{{----------------------------------------------------------------------}}
 {{Traceback (most recent call last):}}
 {{InvalidURL: Failed to parse: test.com:1234some/endpoint}}
  

  was:
This PR introduced a regression on HttpHook.get() where if a port is specified 
on airflow.models.Connection.port and the provided endpoint has no leading 
slash, the URL will fail to parse.

With the connection:

 
{{airflow.models.Connection(}}
{{    conn_id='test_conn',}}
{{    conn_type='http',}}
{{    host='test.com',}}
{{    port=1234}}
{{)}}
{{>>> hook = HttpHook(method='GET', http_conn_id='test_conn')}}

{{>>> hook.get(endpoint='some/endpoint')}}

{{----------------------------------------------------------------------}}
{{Traceback (most recent call last):}}
{{InvalidURL: Failed to parse: test.com:1234some/endpoint}}
 


> HttpHook fails to parse URL when port is specified
> --------------------------------------------------
>
>                 Key: AIRFLOW-3162
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3162
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Eric Chang
>            Assignee: Eric Chang
>            Priority: Minor
>
> https://github.com/apache/incubator-airflow/pull/3379 introduced a regression 
> on HttpHook.get() where if a port is specified on 
> airflow.models.Connection.port and the provided endpoint has no leading 
> slash, the URL will fail to parse.
> With the connection:
>  
>  {{airflow.models.Connection(}}
>  {{    conn_id='test_conn',}}
>  {{    conn_type='http',}}
>  {{    host='test.com',}}
>  {{    port=1234}}
>  {{)}}
>  {{>>> hook = HttpHook(method='GET', http_conn_id='test_conn')}}
> {{>>> hook.get(endpoint='some/endpoint')}}
> {{----------------------------------------------------------------------}}
>  {{Traceback (most recent call last):}}
>  {{InvalidURL: Failed to parse: test.com:1234some/endpoint}}
>   



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to