Fix ingress routing with / (#22728)

This commit is contained in:
Pascal Vizeli 2019-04-04 17:43:18 +02:00 committed by GitHub
parent e29eb4fa23
commit 9bb88a6143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -30,7 +30,7 @@ class HassIOIngress(HomeAssistantView):
"""Hass.io view to handle base part.""" """Hass.io view to handle base part."""
name = "api:hassio:ingress" name = "api:hassio:ingress"
url = "/api/hassio_ingress/{token}/{path:.+}" url = "/api/hassio_ingress/{token}/{path:.*}"
requires_auth = False requires_auth = False
def __init__(self, host: str, websession: aiohttp.ClientSession): def __init__(self, host: str, websession: aiohttp.ClientSession):

View File

@ -8,7 +8,8 @@ import pytest
@pytest.mark.parametrize( @pytest.mark.parametrize(
'build_type', [ 'build_type', [
("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"), ("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"),
("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5") ("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5"),
("fsadjf10312", "")
]) ])
async def test_ingress_request_get( async def test_ingress_request_get(
hassio_client, build_type, aioclient_mock): hassio_client, build_type, aioclient_mock):
@ -40,7 +41,8 @@ async def test_ingress_request_get(
@pytest.mark.parametrize( @pytest.mark.parametrize(
'build_type', [ 'build_type', [
("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"), ("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"),
("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5") ("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5"),
("fsadjf10312", "")
]) ])
async def test_ingress_request_post( async def test_ingress_request_post(
hassio_client, build_type, aioclient_mock): hassio_client, build_type, aioclient_mock):
@ -72,7 +74,8 @@ async def test_ingress_request_post(
@pytest.mark.parametrize( @pytest.mark.parametrize(
'build_type', [ 'build_type', [
("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"), ("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"),
("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5") ("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5"),
("fsadjf10312", "")
]) ])
async def test_ingress_request_put( async def test_ingress_request_put(
hassio_client, build_type, aioclient_mock): hassio_client, build_type, aioclient_mock):
@ -104,7 +107,8 @@ async def test_ingress_request_put(
@pytest.mark.parametrize( @pytest.mark.parametrize(
'build_type', [ 'build_type', [
("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"), ("a3_vl", "test/beer/ping?index=1"), ("core", "index.html"),
("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5") ("local", "panel/config"), ("jk_921", "editor.php?idx=3&ping=5"),
("fsadjf10312", "")
]) ])
async def test_ingress_request_delete( async def test_ingress_request_delete(
hassio_client, build_type, aioclient_mock): hassio_client, build_type, aioclient_mock):