-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lb-proxy-protocol error, extra proxy use unencode query (#703)
* lb-proxy-protocol error, use unencode query * Add unit tests for extra mock
- Loading branch information
Showing
6 changed files
with
81 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
IVERSION = (2, 10, 1) | ||
IVERSION = (2, 10, 2) | ||
VERSION = ".".join(str(i) for i in IVERSION) | ||
LYREBIRD = "Lyrebird " + VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ autopep8==1.7.0 | |
pip | ||
pytest | ||
pytest-cov | ||
pytest-aiohttp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
asyncio_mode = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from aiohttp import web | ||
from lyrebird.mock.extra_mock_server.server import init_app | ||
|
||
config = { | ||
"version": "1.6.8", | ||
"proxy.filters": [ | ||
], | ||
"mock.proxy_headers": { | ||
"scheme": "MKScheme", | ||
"host": "MKOriginHost", | ||
"port": "MKOriginPort" | ||
}} | ||
|
||
|
||
async def test_proxy_args_in_path(aiohttp_client, loop): | ||
app = init_app(config) | ||
client = await aiohttp_client(app) | ||
resp = await client.get('/http://www.bing.com') | ||
assert resp.status == 200 | ||
text = await resp.text() | ||
assert 'bing' in text | ||
|
||
|
||
async def test_proxy_args_in_headers(aiohttp_client, loop): | ||
app = init_app(config) | ||
client = await aiohttp_client(app) | ||
resp = await client.get('/http://www.bing.com', headers={ | ||
'MKScheme': 'http', | ||
'MKOriginHost': 'www.bing.com' | ||
}) | ||
assert resp.status == 200 | ||
text = await resp.text() | ||
assert 'bing' in text | ||
|
||
|
||
async def test_proxy_args_in_query_v1(aiohttp_client, loop): | ||
app = init_app(config) | ||
client = await aiohttp_client(app) | ||
resp = await client.get('/?proxy=http%3A//www.bing.com') | ||
assert resp.status == 200 | ||
text = await resp.text() | ||
assert 'bing' in text | ||
|
||
|
||
async def test_proxy_args_in_query_v2(aiohttp_client, loop): | ||
app = init_app(config) | ||
client = await aiohttp_client(app) | ||
resp = await client.get('/?proxyscheme=http&proxyhost=www.bing.com') | ||
assert resp.status == 200 | ||
text = await resp.text() | ||
assert 'bing' in text |