Skip to content

Commit

Permalink
Warn about lifecycle events with AsyncClient.
Browse files Browse the repository at this point in the history
Improve docs as suggested in tiangolo#2003.
  • Loading branch information
andrew-chang-dewitt committed Nov 10, 2021
1 parent 58ab733 commit 1613689
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/en/docs/advanced/async-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ that we used to make our requests with the `TestClient`.

!!! tip
Note that we're using async/await with the new `AsyncClient` - the request is asynchronous.

!!! warning
If your application relies on events (i.e. `startup` or `shutdown`), HTTPx's `AsyncClient` won't trigger these events. To ensure your ASGI lifecycle events are triggered, you'll need to use an additional context manager, `LifespanManager` from [florimondmanca/asgi-lifespan](https://github.com/florimondmanca/asgi-lifespan#usage), when creating the `AsyncClient`. See [#2003](https://github.com/tiangolo/fastapi/issues/2003#issuecomment-801140731) for more details.

## Other Asynchronous Function Calls

Expand Down

0 comments on commit 1613689

Please sign in to comment.