From b2bcbcec7c21a9fdddad80f9192bf679db858262 Mon Sep 17 00:00:00 2001 From: dead_horse Date: Sat, 3 Oct 2015 11:38:48 +0800 Subject: [PATCH] docs: add request.origin --- docs/api/context.md | 1 + docs/api/request.md | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/api/context.md b/docs/api/context.md index 2e6647b..149e95f 100644 --- a/docs/api/context.md +++ b/docs/api/context.md @@ -148,6 +148,7 @@ koa uses [http-assert](https://github.com/jshttp/http-assert) for assertions. - `ctx.url` - `ctx.url=` - `ctx.originalUrl` + - `ctx.origin` - `ctx.href` - `ctx.path` - `ctx.path=` diff --git a/docs/api/request.md b/docs/api/request.md index a73b2c6..8602c90 100644 --- a/docs/api/request.md +++ b/docs/api/request.md @@ -39,6 +39,15 @@ Get request original URL. +### request.origin + + Get origin of URL, include `protocol` and `host`. + +```js +this.request.origin +// => http://example.com +``` + ### request.href Get full request URL, include `protocol`, `host` and `url`.