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`.