Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
patkivikram authored Mar 6, 2022
2 parents f86debc + f1df56b commit 4234506
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion faust/app/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ async def _route_req(self, dest_url: URL, web: Web, request: Request) -> Respons
if dest_ident == self._urlident(app.conf.canonical_url):
raise SameNode()
routed_url = request.url.with_host(host).with_port(int(port))
async with app.http_client.request(request.method, routed_url) as response:
async with app.http_client.request(
method=request.method, headers=request.headers, url=routed_url
) as response:
return web.text(
await response.text(),
content_type=response.content_type,
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/app/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ async def test_route_req_method(self, *, router, app, mock_http_client):
app.router.key_store = Mock()
app.router.key_store.return_value = URL(f"{routed_url}:{routed_port}")
await router.route_req("foo", "k", web, request)

mock_http_client.request.assert_called_once_with(
request_method, request.url.with_host(routed_url).with_port(routed_port)
method=request_method,
headers=request.headers,
url=request.url.with_host(routed_url).with_port(routed_port),
)

@pytest.mark.asyncio
Expand Down

0 comments on commit 4234506

Please sign in to comment.