From 3819d7de3ba8e7a1c1432a55805d4b8f067cc1e9 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Tue, 4 Sep 2018 15:04:47 +0800 Subject: [PATCH] =?UTF-8?q?docs(API):=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E4=BA=86=20common/http?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/translations/cn/api-plan.md | 4 ++-- packages/common/http/src/backend.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/aio/content/translations/cn/api-plan.md b/aio/content/translations/cn/api-plan.md index 09244278d9..124ccb3a4c 100644 --- a/aio/content/translations/cn/api-plan.md +++ b/aio/content/translations/cn/api-plan.md @@ -65,13 +65,13 @@ [x] | common/JsonPipe | 0.25 [x] | forms/FormArray | 0.25 [x] | common/CommonModule | 0.24 -[ ] | router/NavigationExtras | 0.24 +[x] | router/NavigationExtras | 0.24 [x] | core/HostBinding | 0.23 [x] | core/ContentChild | 0.22 [x] | core/ViewChildren | 0.22 [x] | common/http/HttpResponse | 0.22 [x] | router/ActivatedRouteSnapshot | 0.22 -[ ] | common/http | 0.21 +[x] | common/http | 0.21 [ ] | core/ChangeDetectorRef | 0.21 [ ] | router/NavigationStart | 0.21 [ ] | common/formatDate | 0.21 diff --git a/packages/common/http/src/backend.ts b/packages/common/http/src/backend.ts index 1c0c84cf5f..7061e60e51 100644 --- a/packages/common/http/src/backend.ts +++ b/packages/common/http/src/backend.ts @@ -14,12 +14,18 @@ import {HttpEvent} from './response'; * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a * `HttpResponse`. * + * 把一个 `HttpRequest` 转换成 `HttpEvent` 组成的流,`HttpResponse` 就是其中之一。 + * * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the * `HttpBackend`. * + * `HttpHandler` 是可注入的。当被注入时,该处理器的实例会把请求派发给拦截器链中的第一个拦截器,第一个拦截器会再派发给第二个拦截器,以此类推。 + * 最终抵达 `HttpBackend`。 + * * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain. * + * 在 `HttpInterceptor` 中,`HttpHandler` 参数就表示链中的下一个拦截器。 * */ export abstract class HttpHandler { @@ -29,11 +35,16 @@ export abstract class HttpHandler { /** * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend. * + * 最后一个 `HttpHandler`,它将会把该请求通过浏览器的 HTTP API 发到后端。 + * * Interceptors sit between the `HttpClient` interface and the `HttpBackend`. * + * 拦截器位于 `HttpClient` 接口和 `HttpBackend` 之间。 + * * When injected, `HttpBackend` dispatches requests directly to the backend, without going * through the interceptor chain. * + * 当它被注入时,`HttpBackend` 会把请求直接发给后端,而不会经过拦截器链。 * */ export abstract class HttpBackend implements HttpHandler {