# Path: via/get_url.py
# def get_url_details(http_service, url, headers=None):
#     """Get the content type and status code for a given URL.
# 
#     :param http_service: Instance of HTTPService to make the request with
#     :param url: URL to retrieve
#     :param headers: The original headers the request was made with
#     :return: 2-tuple of (mime type, status code)
# 
#     :raise BadURL: When the URL is malformed
#     :raise UpstreamServiceError: If we server gives us errors
#     :raise UnhandledException: For all other request based errors
#     """
#     if headers is None:
#         headers = OrderedDict()
# 
#     if GoogleDriveAPI.parse_file_url(url):
#         return "application/pdf", 200
# 
#     headers = add_request_headers(clean_headers(headers))
# 
#     with http_service.get(
#         url,
#         stream=True,
#         allow_redirects=True,
#         headers=headers,
#         timeout=10,
#         raise_for_status=False,
#     ) as rsp:
#         content_type = rsp.headers.get("Content-Type")
#         if content_type:
#             mime_type, _ = cgi.parse_header(content_type)
#         else:
#             mime_type = None
# 
#         return mime_type, rsp.status_code


from io import BytesIO
from unittest.mock import sentinel
from h_matchers import Any
from requests import Response
from via.get_url import get_url_details
import pytest
        content_type,
        mime_type,
        status_code,
        http_service,
    ):
        if content_type:
            response.headers = {"Content-Type": content_type}
        else:
            response.headers = {}

        response.status_code = status_code

        url = "http://example.com"

        result = get_url_details(http_service, url, headers=sentinel.headers)

        assert result == (mime_type, status_code)
        http_service.get.assert_called_once_with(
            url,
            allow_redirects=True,
            stream=True,
            headers=Any(),
            timeout=10,
            raise_for_status=False,
        )

    @pytest.mark.usefixtures("response")
    def test_it_modifies_headers(
        self, clean_headers, add_request_headers, http_service
    ):

# Path: via/get_url.py
# def get_url_details(http_service, url, headers=None):
#     """Get the content type and status code for a given URL.
# 
#     :param http_service: Instance of HTTPService to make the request with
#     :param url: URL to retrieve
#     :param headers: The original headers the request was made with
#     :return: 2-tuple of (mime type, status code)
# 
#     :raise BadURL: When the URL is malformed
#     :raise UpstreamServiceError: If we server gives us errors
#     :raise UnhandledException: For all other request based errors
#     """
#     if headers is None:
#         headers = OrderedDict()
# 
#     if GoogleDriveAPI.parse_file_url(url):
#         return "application/pdf", 200
# 
#     headers = add_request_headers(clean_headers(headers))
# 
#     with http_service.get(
#         url,
#         stream=True,
#         allow_redirects=True,
#         headers=headers,
#         timeout=10,
#         raise_for_status=False,
#     ) as rsp:
#         content_type = rsp.headers.get("Content-Type")
#         if content_type:
#             mime_type, _ = cgi.parse_header(content_type)
#         else:
#             mime_type = None
# 
#         return mime_type, rsp.status_code


# Path: tests/unit/via/get_url_test.py
from io import BytesIO
from unittest.mock import sentinel
from h_matchers import Any
from requests import Response
from via.get_url import get_url_details
import pytest

        content_type,
        mime_type,
        status_code,
        http_service,
    ):
        if content_type:
            response.headers = {"Content-Type": content_type}
        else:
            response.headers = {}

        response.status_code = status_code

        url = "http://example.com"

        result = get_url_details(http_service, url, headers=sentinel.headers)

        assert result == (mime_type, status_code)
        http_service.get.assert_called_once_with(
            url,
            allow_redirects=True,
            stream=True,
            headers=Any(),
            timeout=10,
            raise_for_status=False,
        )

    @pytest.mark.usefixtures("response")
    def test_it_modifies_headers(
        self, clean_headers, add_request_headers, http_service
    ):

        get_url_details(