docs: add request.origin

This commit is contained in:
dead_horse 2015-10-03 11:38:48 +08:00
parent 1ed691dde3
commit b2bcbcec7c
2 changed files with 10 additions and 0 deletions

View file

@ -148,6 +148,7 @@ koa uses [http-assert](https://github.com/jshttp/http-assert) for assertions.
- `ctx.url` - `ctx.url`
- `ctx.url=` - `ctx.url=`
- `ctx.originalUrl` - `ctx.originalUrl`
- `ctx.origin`
- `ctx.href` - `ctx.href`
- `ctx.path` - `ctx.path`
- `ctx.path=` - `ctx.path=`

View file

@ -39,6 +39,15 @@
Get request original URL. Get request original URL.
### request.origin
Get origin of URL, include `protocol` and `host`.
```js
this.request.origin
// => http://example.com
```
### request.href ### request.href
Get full request URL, include `protocol`, `host` and `url`. Get full request URL, include `protocol`, `host` and `url`.