From 039805265fec58ceb8644a8ceef19bc8aaff0443 Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Wed, 18 Dec 2013 23:47:48 -0800 Subject: [PATCH 1/5] docs request: typo --- docs/api/request.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/api/request.md b/docs/api/request.md index a2cfb50..1f1d21e 100644 --- a/docs/api/request.md +++ b/docs/api/request.md @@ -1,4 +1,3 @@ - # Request A Koa `Request` object is an abstraction on top of node's vanilla request object, @@ -124,7 +123,7 @@ this.body = yield db.find('something'); ### req.secure - Shorthand for `this.protocol == "https"` to check if a requset was + Shorthand for `this.protocol == "https"` to check if a request was issued via TLS. ### req.ip From e00f2aee9d1d3c0dce5fd7e1725515ebac8982bb Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Wed, 18 Dec 2013 23:48:45 -0800 Subject: [PATCH 2/5] docs response: fix md list jank --- docs/api/response.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/api/response.md b/docs/api/response.md index f36e1e6..8f7eef6 100644 --- a/docs/api/response.md +++ b/docs/api/response.md @@ -1,4 +1,3 @@ - # Response A Koa `Response` object is an abstraction on top of node's vanilla response object, @@ -76,9 +75,9 @@ - 510 "not extended" - 511 "network authentication required" - __NOTE__: don't worry too much about memorizing these strings, - if you have a typo an error will be thrown, displaying this list - so you can make a correction. +__NOTE__: don't worry too much about memorizing these strings, +if you have a typo an error will be thrown, displaying this list +so you can make a correction. ### res.length= @@ -243,4 +242,4 @@ this.response.lastModified = new Date(); ```js this.response.etag = crypto.createHash('md5').update(this.body).digest('hex'); -``` \ No newline at end of file +``` From 0c024c48a8845eb2b00b18ce754dc7b279260785 Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Wed, 18 Dec 2013 23:51:51 -0800 Subject: [PATCH 3/5] docs response: fix redirect for correctness do we want to check if the body is already set? --- docs/api/response.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/response.md b/docs/api/response.md index 8f7eef6..a4978f4 100644 --- a/docs/api/response.md +++ b/docs/api/response.md @@ -202,8 +202,8 @@ this.redirect('/login'); this.redirect('http://google.com'); ``` - To alter the default status of `302` or the response - body simply assign before and re-assign after this call: + To alter the default status of `302`, simply assign the status + before or after this call. To alter the body, assign it after this call: ```js this.status = 301; From 2f4163f6e67c777f2d73fbd4a4299434d2201fc6 Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Wed, 18 Dec 2013 23:56:26 -0800 Subject: [PATCH 4/5] docs app: some copy changes and typo fixes --- docs/api/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api/index.md b/docs/api/index.md index 9e48860..51cc668 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -27,8 +27,8 @@ app.listen(3000); ## Cascading Koa middleware cascading in a more traditional way as you may be use to with similar tools - - this was previsouly not impossible, but difficult to make user friendly due to node's callbacks, - however with generators we can achieve "true" middlware. Contrasting Connect's implementation which + this was previously very difficult to make user friendly due to node's callbacks. + However with generators we can achieve "true" middlware. Contrasting Connect's implementation which simply passes control through series of functions until one returns, Koa yields "downstream", then control flows back "upstream". @@ -84,9 +84,9 @@ app.listen(3000); ## app.listen(...) - A Koa application is not a 1-to-1 representation of an HTTP server, - as one or more Koa applications may be mounted together to form larger - applications, with a single HTTP server. + A Koa application is not a 1-to-1 representation of a HTTP server. + One or more Koa applications may be mounted together to form larger + applications with a single HTTP server. Create and return an HTTP server, passing the given arguments to `Server#listen()`. These arguments are documented on [nodejs.org](http://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback). The following is a useless Koa application bound to port `3000`: @@ -106,7 +106,7 @@ var app = koa(); http.createServer(app.callback()).listen(3000); ``` - This means you can spin up the same application as both HTTP and HTTPS, + This means you can spin up the same application as both HTTP and HTTPS or on multiple addresses: ```js From ddde5f96efcadb5009c71bdbc406c6038834d519 Mon Sep 17 00:00:00 2001 From: Eivind Fjeldstad Date: Thu, 19 Dec 2013 11:48:32 +0100 Subject: [PATCH 5/5] add deprecation warning for ctx.error Didn't notice the change until now. A warning would be useful --- lib/context.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/context.js b/lib/context.js index bfade5b..050ea1a 100644 --- a/lib/context.js +++ b/lib/context.js @@ -75,6 +75,7 @@ module.exports = { */ error: function(msg, status){ + console.warn('ctx.error is deprecated, use ctx.throw'); this.throw(msg, status); },