forked from aio-libs/aiohttp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix bug that broke HTTP proxy support * add functional tests via mitmdump fixes aio-libs#1413
- Loading branch information
Showing
5 changed files
with
79 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ ipdb==0.10.1 | |
pytest-sugar==0.7.1 | ||
ipython==5.1.0 | ||
aiodns==1.1.1 | ||
mitmproxy==0.18.2 |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def response(flow): | ||
flow.response.headers["X-Mitmdump"] = "1" |
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,20 @@ | ||
import asyncio | ||
|
||
from aiohttp import web | ||
|
||
|
||
@asyncio.coroutine | ||
def test_proxy_via_mitmdump(loop, test_client, fake_proxy): | ||
@asyncio.coroutine | ||
def handler(request): | ||
return web.Response(text=request.method) | ||
|
||
app = web.Application(loop=loop) | ||
app.router.add_get('/', handler) | ||
|
||
client = yield from test_client(app) | ||
resp = yield from client.get('/', proxy=fake_proxy.url()) | ||
assert 200 == resp.status | ||
assert 'X-Mitmdump' in resp.headers | ||
assert resp.headers['X-Mitmdump'] == '1' | ||
resp.close() |