Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.7k
Comments
🌐 Add Chinese translation for Tutorial - Middleware#2334
🌐 Add Chinese translation for Tutorial - Middleware#2334tiangolo merged 8 commits intofastapi:masterfrom
Conversation
codecovbot commentedNov 10, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #2334 +/- ##========================================= Coverage 100.00% 100.00% ========================================= Files 242 242 Lines 7396 7396 ========================================= Hits 7396 7396 Continue to review full report at Codecov.
|
lpdswing commentedNov 10, 2020
@tiangolo I don't know why occured this error when build doc . |
tiangolo commentedNov 10, 2020
Hey@lpdswing ! Thanks for letting me know. The error had nothing to do with you, it was caused by a recent change I made when I enabled the new features ofMaterial for MkDocs Insiders, but I incorrectly handled the install in PRs from forks. I just fixed it and updated your branch, so it's now passing and ready for review 🎉 |
📝 Docs preview for commit323c67e at:https://5faaf0395dbd2f556b35a13a--fastapi.netlify.app |
lpdswing commentedNov 11, 2020 via email
OK,thx发自我的华为手机-------- 原始邮件 --------发件人: Sebastián Ramírez <notifications@github.com>日期: 2020年11月11日周三 凌晨3:56收件人: tiangolo/fastapi <fastapi@noreply.github.com>抄送: lpdswing <lpdswing@qq.com>, Mention <mention@noreply.github.com>主 题: Re: [tiangolo/fastapi] Add chinese translate for tutorial-middleware (#2334)Hey@lpdswing ! Thanks for letting me know.The error had nothing to do with you, it was caused by a recent change I made when I enabled the new features of Material for MkDocs Insiders, but I incorrectly handled the install in PRs from forks.I just fixed it and updated your branch, so it's now passing and ready for review 🎉—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
docs/zh/docs/tutorial/middleware.md Outdated
| * 它接收你的应用程序的每一个**request**. | ||
| * 然后它可以对这个**request**做一些事情或者执行任何需要的代码. | ||
| * 然后它将**request**传递给应用程序的其他部分 (通过某种*路径操作*). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
然后它将请求传递给应用程序的其他部分(某个路径操作)进行处理。
Uh oh!
There was an error while loading.Please reload this page.
docs/zh/docs/tutorial/middleware.md Outdated
| * 然后它返回这个 **response**. | ||
| !!! note "技术细节" | ||
| 如果你依赖了 `yield`, 退出代码将在执行中间件*后*执行. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
如果你有使用了yield 关键字的依赖,依赖中的退出代码将在执行中间件之后执行。
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
📝 Docs preview for commit5cc7e56 at:https://5faccda1187ac845973be867--fastapi.netlify.app |
docs/zh/docs/tutorial/middleware.md Outdated
| 要创建中间件你可以在函数的顶部使用装饰器 `@app.middleware("http")`. | ||
| 中间件参数接收: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
中间件函数接收如下参数:
docs/zh/docs/tutorial/middleware.md Outdated
| * 然后它返回这个 **响应**. | ||
| !!! note "技术细节" | ||
| 如果你使用了 `yield`关键字依赖, 依赖中的退出代码将在执行中间件*后*执行. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Leave a space afteryield.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
删除空格?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
应该是yhield 前后都要有空格。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
yield 后面加个空格
docs/zh/docs/tutorial/middleware.md Outdated
| * `request`. | ||
| * 一个函数 `call_next` 它将接收 `request` 作为参数. | ||
| * 这个函数将 `request` 传递个相应的 *路径操作*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
传递给
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
thx
docs/zh/docs/tutorial/middleware.md Outdated
| !!! note "技术细节" | ||
| 你也可以使用 `from starlette.requests import Request`. | ||
| **FastAPI** 为了开发者方便提供了该对象. 但其实它直接来自于Starlette. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Leave a space beforeStarlette.
| !!! tip | ||
| 请记住可以 <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">用'X-' 前缀</a>添加专有自定义请求头. | ||
| 但是如果你想让浏览器中的客户端看到你的自定义请求头, 你需要把它们加到 CORS 配置 ([CORS (Cross-Origin Resource Sharing)](cors.md){.internal-link target=_blank}) 的 `expose_headers` 参数中,在 <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette's CORS docs</a>文档中. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Leave spaces forStarlette's CORS docs.
| ### 在 `response` 的前和后 | ||
| 在任何*路径操作*收到`request`前,可以添加要和请求一起运行的代码. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Wrap enlish words with a space.
…g_zh/tutorial-middleware
📝 Docs preview for commitacdf714 at:https://5fbdba4452dc482fa61cf1fc--fastapi.netlify.app |
waynerv left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You should also translate all the punctuation marks.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
docs/zh/docs/tutorial/middleware.md Outdated
| 要创建中间件你可以在函数的顶部使用装饰器 `@app.middleware("http")`. | ||
| 中间件参数接收: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
中间件函数接受:
docs/zh/docs/tutorial/middleware.md Outdated
| * 然后它返回这个 **响应**. | ||
| !!! note "技术细节" | ||
| 如果你使用了 `yield`关键字依赖, 依赖中的退出代码将在执行中间件*后*执行. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
应该是yhield 前后都要有空格。
tiangolo commentedNov 25, 2020
Awesome! Thank you@lpdswing for your contribution! 🍰 🚀 And thanks@waynerv,@RunningIkkyu, and@maoyibo for the reviews 🙇 ☕ I'm going to wait for the punctuation fixes and then the approval by@waynerv before merging 🤓 📝 |
…wing/fastapi; branch 'master' ofhttps://github.com/tiangolo/fastapi into lang_zh/tutorial-middleware
📝 Docs preview for commitb4820dd at:https://5fc4a2afb9a514801bc630d2--fastapi.netlify.app |
waynerv left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@tiangolo I think this PR is ready for merging.
tiangolo commentedMar 27, 2021
Excellent, thanks for the confirmation@waynerv ! 🚀 |

No description provided.