Add support for detecting hostname based addresses as internal (#67407)

This commit is contained in:
Paulus Schoutsen
2022-03-01 16:56:05 -08:00
committed by GitHub
parent de2ddfe7b7
commit 65eefcacfc
3 changed files with 51 additions and 17 deletions

View File

@@ -25,7 +25,9 @@ class NoURLAvailableError(HomeAssistantError):
def is_internal_request(hass: HomeAssistant) -> bool:
"""Test if the current request is internal."""
try:
_get_internal_url(hass, require_current_request=True)
get_url(
hass, allow_external=False, allow_cloud=False, require_current_request=True
)
return True
except NoURLAvailableError:
return False