Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: (core/httpclient): [translate] Done #1409

Merged
merged 4 commits into from
Sep 12, 2017

Conversation

DarrenWong
Copy link
Contributor

@DarrenWong DarrenWong commented Sep 11, 2017

Checklist
  • documentation is changed or added
Affected core subsystem(s)

docs/source/en/core/i18n.md
docs/source/zh-cn/core/i18n.md

Description of change

Translated https://github.com/eggjs/egg/blob/master/docs/source/zh-cn/core/httpclient.md
and minor revise the format of zh-cn:

  1. revised the link of #options-参数详解 and a unknown symbol

  2. Need further review below example. Don't have the comment in the original files and the example is a little confuse that don't have the comma or semicolon between parameters. Might refer to liburl


### `request` 事件:发生在网络操作发生之前

请求发送之前,会触发一个 `request` 事件,允许对请求做拦截。

```js
app.httpclient.on('request', req => {
  req.url 请求 url
  req.ctx 是发起这次请求的当前上下文

  // 可以在这里设置一些 trace headers,方便全链路跟踪
});

response 事件:发生在网络操作结束之后

请求结束之后会触发一个 response 事件,这样外部就可以订阅这个事件打印日志。

app.httpclient.on('response', result => {
  result.res.status
  result.ctx 是发起这次请求的当前上下文
  result.req 对应的 req 对象,即 request 事件里面那个 req
});

@mention-bot
Copy link

@DarrenWong, thanks for your PR! By analyzing the history of the files in this pull request, we identified @atian25, @fengmk2 and @huacnlee to be potential reviewers.

@codecov
Copy link

codecov bot commented Sep 11, 2017

Codecov Report

Merging #1409 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1409   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          29       29           
  Lines         715      715           
=======================================
  Hits          713      713           
  Misses          2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 105e194...1b78026. Read the comment docs.

@DarrenWong
Copy link
Contributor Author

@fengmk2 @atian25 @dead-horse would you mind helping to review?

Copy link
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@fengmk2 fengmk2 merged commit 6cf17c1 into eggjs:master Sep 12, 2017
popomore pushed a commit that referenced this pull request Sep 12, 2017
docs: (core/httpclient): [translate] Done  (#1409)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants