Commit graph

154 commits

Author SHA1 Message Date
Tejas Manohar
6c19c41c09 keep test env logging for backwards-compat 2015-10-08 19:02:36 -05:00
Tejas Manohar
ea4754e332 ensure all JS files have blank newline at top 2015-10-05 18:18:03 -05:00
Tejas Manohar
c369b33b23 app.silent option to turn off err logging 2015-10-05 17:51:26 -05:00
gyson
1be333ca31 change respond() to a regular function
remove `yield* next` in lib/application, which caused annoy `A promise
was converted into a generator …` message.

benchmark result:
* when bench with native Promise, it has no impact for both stable and
experimental ones.
* when bench with Bluebird, it’s about 5-10% faster than original for
both stable and experimental ones.

closes #472
2015-08-23 13:55:20 -07:00
Sterling Williams
391650518f Do not log on expected http errors 2015-08-22 14:39:38 -07:00
fengmk2
8b14b91bae remove body empty detect 2015-03-29 14:40:09 +08:00
fengmk2
1edd6ec69a test: improve test coverage for application and response 2015-03-29 14:40:09 +08:00
Jonathan Ong
c5545cd918 add experimental async function support 2015-02-14 17:33:08 -08:00
Jonathan Ong
5b7587bb7e use Object.setPrototypeOf() instead of __proto__ 2015-02-01 16:39:44 -08:00
TJ Holowaychuk
e4076ce930 remove x-powered-by. Closes #372 2014-12-04 01:01:57 -08:00
TJ Holowaychuk
b854d00363 Merge pull request #366 from MatthewMueller/master
add: ctx.locals as a recommended namespace for passing information to the frontend
2014-11-18 08:19:19 -08:00
Matthew Mueller
6847fe68bd added: ctx.state as the recommended namespace for passing information through middleware and routes. 2014-11-18 00:54:14 -08:00
dead_horse
3f183a196b upgrade co@4 2014-11-17 21:21:00 +08:00
dead_horse
efdd7d3716 less strict for status, close #350
add res.message[=]
2014-10-09 23:20:53 +08:00
TJ Holowaychuk
7b3e3cbad5 add fn assertion to app.use(). Closes #337 2014-08-20 13:28:34 -07:00
Jonathan Ong
9455726c00 finished -> on-finished
removes the writable test because it’s fake and there are tests for
on-finished for this case
2014-08-16 02:58:06 -07:00
Jonathan Ong
1605f33760 add context.inspect(), cleanup app.inspect()
closes #323 closes #250
2014-08-02 18:24:53 -07:00
TJ Holowaychuk
90c528c5e8 remove if (!err) from app.onerror
we assert instanceof Error right below
2014-06-05 16:37:28 -07:00
dead_horse
4979077562 assert non-error obj pass to app.onerror, fixed #287 2014-06-04 14:16:25 +08:00
TJ Holowaychuk
c16211c5d6 refactor 2014-05-01 17:46:09 -07:00
TJ Holowaychuk
f17629d19f remove .outputErrors, suppress output when handled by the dev. Closes #272 2014-05-01 16:29:37 -07:00
TJ Holowaychuk
4ff54e5c13 ocd 2014-05-01 16:25:08 -07:00
TJ Holowaychuk
80ace2c0bb add nicer error formatting 2014-05-01 16:18:40 -07:00
TJ Holowaychuk
15ab936001 change .status default to 404. Closes #263 2014-04-28 21:17:46 -07:00
Jonathan Ong
0cacc5706a use koa-is-json 2014-04-25 00:15:33 -07:00
TJ Holowaychuk
74cb04e7c1 refactor 2014-04-15 08:39:40 -07:00
TJ Holowaychuk
0a954c8d99 ocd 2014-04-15 08:35:10 -07:00
dead_horse
b06bb3cb85 simplify respond 2014-04-15 23:31:11 +08:00
TJ Holowaychuk
95a78c3a44 Merge pull request #255 from dead-horse/stream-body
make sure all intermediate stream bodies will be destroy
2014-04-14 15:34:13 -07:00
dead_horse
69c82f63b5 fix length when .body is missing 2014-04-13 11:35:28 +08:00
dead_horse
64aad129d3 fix this.status= in this.body
fix default status set bug in this.body=null.
do not call this.status= if this.status exist.
make sure empty content status remove content headers
2014-04-10 11:47:30 +08:00
dead_horse
329d2b94db make sure all intermediate stream bodies will be destroy and have error handle 2014-04-10 00:02:13 +08:00
Dmitry Mazuro
9e8d6a3aa0 ocd 2014-03-24 21:21:15 +03:00
Jonathan Ong
52cb57cc7e fix overwriting of content-type w/ HEAD requests 2014-03-23 04:01:14 -07:00
Jonathan Ong
182f9d6fa4 refactor: use statuses 2014-03-12 18:29:14 -07:00
TJ Holowaychuk
895cf4040c add app.toJSON() 2014-03-11 11:01:33 -07:00
Jonathan Ong
cb532b7bef this.writable to check if the socket is writable
because node sucks haha
2014-02-15 02:06:08 -08:00
TJ Holowaychuk
aa08845c70 remove app.jsonSpaces setting. Closes #202 2014-01-31 18:39:47 -08:00
Jonathan Ong
ea5757ff57 remove app.keys getter/setter
closes #203
2014-01-31 16:09:29 -08:00
Jonathan Ong
c5655e093a bump cookies to 0.4.0
no longer need to do that keygrip stuff, though i’m more inclined to
remove all the error checking.
2014-01-31 13:52:27 -08:00
Jonathan Ong
2bc3bb7327 this.respond=false for bypassing koa's response handling
closes #198
2014-01-24 14:38:40 -08:00
Jonathan Ong
ea1a631bb1 bump finished and mocha 2014-01-16 22:33:02 -08:00
Jonathan Ong
b7b1c0fd44 better 404 handling 2013-12-29 22:26:19 -08:00
Jonathan Ong
51da356a5f debug: check for fn._name as well 2013-12-29 16:04:06 -08:00
Jonathan Ong
7fe4133b4a refactor: move content negotiation to accepts 2013-12-27 18:56:02 -08:00
Jonathan Ong
0d9336622c use yield *next internally 2013-12-22 14:48:28 -08:00
mako-taco
9fe483ca76 handle manually written responses 2013-12-22 14:46:36 -08:00
Jonathan Ong
879293f548 use on-socket-error 2013-12-20 14:39:53 -08:00
Jonathan Ong
61d437d746 remove next in callback for now
revisit mounting later
2013-12-19 23:13:37 -08:00
Jonathan Ong
38d5bad4d1 bumpity boop co 2013-12-19 22:33:35 -08:00
Jonathan Ong
938a67c94f lint: remove unused requires
duh.
2013-12-19 21:16:19 -08:00
Jonathan Ong
34104c9af3 refactor: allow any streams with .pipe method 2013-12-19 21:14:47 -08:00
TJ Holowaychuk
70971dcb53 add GeneratorFunction assertion for app.use(). Closes #120
breaks old old shit but thats ok, super early in the game
2013-12-19 10:03:08 -08:00
TJ Holowaychuk
171892c669 fix: cleanup socker error handler on response 2013-12-19 08:53:48 -08:00
TJ Holowaychuk
1769f9c431 add socket error-handling. Closes #114 2013-12-17 17:37:35 -08:00
TJ Holowaychuk
309f2ac00e add debug() for .listen() and .keys= 2013-11-26 21:26:05 -08:00
Jonathan Ong
1dd1d02db0 app.respond: support 205 status codes as no-content
pretty new to me, but it’s basically the same as 204
2013-11-19 22:20:17 -08:00
Jonathan Ong
9407d7776c context: cross-reference request and response 2013-11-18 14:10:11 -08:00
TJ Holowaychuk
cb682ed904 add body.close check for HEAD requests 2013-11-15 11:33:14 -08:00
TJ Holowaychuk
27d1336af5 Merge pull request #89 from koajs/keygrip
add keygrip support
2013-11-15 11:31:23 -08:00
TJ Holowaychuk
f3a6f6ae39 fix stream leak on HEAD. Closes #91 2013-11-15 10:49:28 -08:00
TJ Holowaychuk
f4b7f279ea ocd 2013-11-15 10:09:56 -08:00
Jonathan Ong
0362c8e457 add app.keys support 2013-11-15 10:04:07 -08:00
Jonathan Ong
18c2cd1dac this.originalUrl && this.request.originalUrl 2013-11-14 14:18:05 -08:00
Jonathan Ong
0be1442111 expose app-specific prototypes, cleanup/fix tests 2013-11-13 18:41:40 -08:00
Jonathan Ong
accb1d6a61 pass an optional next to app.callback() 2013-11-08 01:17:41 -08:00
Jonathan Ong
2a7b6d07bf remove unused var 2013-11-08 01:14:43 -08:00
Jonathan Ong
1bcf9b413f remove unnecessary closure 2013-11-08 01:04:26 -08:00
TJ Holowaychuk
c1bed668bd remove app.context() for now
get away from promoting the extension of prototypes, aside
from it looking better there isnt really a compelling reason
to allow this
2013-11-07 17:05:26 -08:00
TJ Holowaychuk
2d35cdff50 add new style middleware support through @jonathanong's koa-compose patch 2013-11-07 16:15:47 -08:00
Jonathan Ong
3c3b81b960 Merge pull request #60 from jonathanong/warn-context-overwrite
debug context: notify if a property is being overwritten
2013-10-25 03:49:23 -07:00
Jonathan Ong
cb60fb872a only listen to stream errors if not already 2013-10-14 22:40:02 -07:00
TJ Holowaychuk
1810977700 update co to 2.0 2013-10-14 16:50:05 -07:00
Jonathan Ong
df367e0749 debug: notify if a property is being overwritten 2013-10-05 12:56:36 -07:00
Jonathan Ong
98a386a485 bind .onerror to context 2013-10-05 12:32:05 -07:00
Jonathan Ong
4aa75a1164 cleanup trailing whitespace in .js files 2013-10-05 12:27:15 -07:00
TJ Holowaychuk
11913f5e4e add ctx.body= setter
this prevents a bunch of redundant checks that middleware may need to
check response length, type etc. the less code floating around based
on our supported response body types the better, giving us more freedom
to change these as needed, and just less error-prone code in general.
2013-09-14 15:54:17 -07:00
TJ Holowaychuk
7a26886040 change app.onerror to ignore 404s
so you can easily unwind the stack for 404s
2013-09-13 20:54:52 -07:00
TJ Holowaychuk
92b741ac0a remove socket error handling, use server "clientError" 2013-09-08 11:44:45 -07:00
TJ Holowaychuk
cf54f7d7d5 remove a console.log 2013-09-08 11:41:52 -07:00
TJ Holowaychuk
2fe83a4e3d add failing socket error handling test 2013-09-08 11:41:43 -07:00
TJ Holowaychuk
02ae4f787d fix socket "error" handling
always has clientError now
2013-09-08 11:27:16 -07:00
TJ Holowaychuk
67b49cf82d remove unnecessary .bind() 2013-09-08 09:37:33 -07:00
TJ Holowaychuk
f6161918ee Merge branch 'master' of github.com:koajs/koa 2013-09-02 18:29:04 -07:00
Karl Böhlmark
520df772ef use byteLength when calculating content-length 2013-09-02 23:55:38 +02:00
TJ Holowaychuk
7754a3535a move downstream logic to response middleware 2013-09-01 16:27:03 -07:00
TJ Holowaychuk
b3761b5da0 Merge branch 'master' of github.com:koajs/koa 2013-08-31 09:17:16 -07:00
Kim Joar Bekkelund
baefcacff9 typo 2013-08-30 23:09:18 +02:00
TJ Holowaychuk
32d65cfe91 add basic instrumentation 2013-08-28 21:10:25 -07:00
TJ Holowaychuk
fae98c10ec add context debug() 2013-08-27 21:24:53 -07:00
TJ Holowaychuk
ddc7347afe change "unnamed" middleware to -, less junk output 2013-08-27 21:23:11 -07:00
TJ Holowaychuk
99895aa215 change app to emit "error" events instead of app.error(fn) 2013-08-27 20:24:04 -07:00
TJ Holowaychuk
3439437c18 add app.error(fn). Closes #4 2013-08-22 18:47:07 -07:00
TJ Holowaychuk
832a1dcc1e change socket error listener to just use length 2013-08-22 11:53:14 -07:00
TJ Holowaychuk
4e4fcfc642 fix socket error handler event listener leak 2013-08-22 11:52:22 -07:00
TJ Holowaychuk
fe89dc3783 add socket error-handling. Closes #6
otherwise node just explodes, not a good default
2013-08-21 19:52:01 -07:00
TJ Holowaychuk
b4b0789d7a fix .onerror bind for stream "error" handling 2013-08-21 19:50:32 -07:00
TJ Holowaychuk
9d7720f2d8 change .outputErrors to false for "test" env only
good to know in prod ;)
2013-08-21 19:48:47 -07:00
TJ Holowaychuk
2de010ca47 add err.status support. Closes #20 2013-08-21 19:47:56 -07:00
TJ Holowaychuk
ca7be7b89f add Context#cookies support. Closes #7
need to add signing support in there as well
2013-08-20 21:51:14 -07:00