]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🌐 Add Chinese translation for `docs/zh/docs/advanced/testing-websockets.md` (#3817)
authorjaystone776 <jilei776@gmail.com>
Sun, 28 Jan 2024 18:12:29 +0000 (02:12 +0800)
committerGitHub <noreply@github.com>
Sun, 28 Jan 2024 18:12:29 +0000 (13:12 -0500)
docs/zh/docs/advanced/testing-websockets.md [new file with mode: 0644]

diff --git a/docs/zh/docs/advanced/testing-websockets.md b/docs/zh/docs/advanced/testing-websockets.md
new file mode 100644 (file)
index 0000000..f303e1d
--- /dev/null
@@ -0,0 +1,13 @@
+# 测试 WebSockets
+
+测试 WebSockets 也使用 `TestClient`。
+
+为此,要在 `with` 语句中使用 `TestClient` 连接 WebSocket。
+
+```Python hl_lines="27-31"
+{!../../../docs_src/app_testing/tutorial002.py!}
+```
+
+!!! note "笔记"
+
+    更多细节详见 <a href="https://www.starlette.io/testclient/#testing-websocket-sessions" class="external-link" target="_blank">Starlette 官档 - 测试 WebSockets</a>。