Commit graph

331 commits

Author SHA1 Message Date
André Cruz
99051992a9 fix: Status message is not supported on HTTP/2 (#1264) 2018-11-10 01:41:21 +08:00
Martin Iwanowski
71aaa29591 docs: fix spelling in throw docs (#1269) 2018-11-05 17:16:27 +08:00
Jordan
bc81ca9414 chore: use res instead of this.res (#1271) 2018-11-05 17:15:58 +08:00
Waleed Ashraf
88b92b4315 doc: updated docs for throw() to pass status as first param. (#1268) 2018-11-01 19:17:16 +08:00
fengmk2
4964242834 fix: use X-Forwarded-Host first on app.proxy present (#1263) 2018-10-23 15:20:09 +08:00
Martin Michaelis
9c5c58b183 feat: use :authority header of http2 requests as host (#1262)
close #1174
2018-10-23 13:21:20 +08:00
小雷
9146024e10 feat: response.attachment append a parameter: options from contentDisposition (#1240) 2018-10-08 22:43:11 +08:00
Yiyu He
0b930665a8
perf: avoid stringify when set header (#1220) 2018-07-12 14:10:12 +08:00
Yiyu He
c6b8782553 perf: cache content type's result (#1218) 2018-07-11 17:49:25 +08:00
Yiyu He
162a5b3e78 perf: lazy init cookies and ip when first time use it (#1216) 2018-07-11 11:18:39 +08:00
小菜
74170caf0b chore: fix comment & approve cov (#1214) 2018-07-04 11:33:01 +08:00
小菜
2cdbc52e38 test&cov: add test case (#1211) 2018-07-01 01:29:19 +08:00
initial-wu
02feadc4db Lazily initialize request.accept and delegate context.accept (#1209) 2018-06-25 16:13:20 +08:00
Ruben Bridgewater
8f047ddb84 fix: use non deprecated custom inspect (#1198)
Custom inspection with the `inspect` property is deprecated and will
not work in Node.js 11 anymore. This fixes it by using the custom
inspect symbol where existent and falls back to the old style in case
it does not exist.
2018-06-25 10:34:15 +08:00
initial-wu
77a4cfb829 Simplify processes in the getter request.protocol (#1203) 2018-06-07 22:50:26 +08:00
initial-wu
ee1a933096 fix: Throw a TypeError instead of a AssertionError (#1199) 2018-06-06 12:55:20 +08:00
initial-wu
ef33a79874 chore: mistake in a comment (#1201) 2018-06-04 10:18:42 +08:00
initial-wu
148f26f630 chore: use this.res.socket insteadof this.ctx.req.socket (#1177)
prefer a shorter path to the object
2018-04-27 23:51:47 +08:00
Grand
45903f228a chore: Using "listenerCount" instead of "listeners" (#1184) 2018-04-27 23:48:51 +08:00
Shawn Cheung
8c17517809 use this.response insteadof this.ctx.response (#1163) 2018-03-23 17:56:32 +08:00
Yiyu He
3c23aa5b74
feat: ignore set header/status when header sent (#1137) 2018-02-11 16:25:24 +08:00
Alexsey
6baa41178d Error handling: on non-error throw try to stringify if error is an object (#1113) 2017-12-24 20:48:44 +08:00
Riceball LEE
53a4446123 expose the Application::handleRequest method (#950)
* * expose the Application::handleRequest method to extend the context

* * minor change the handleRequest comment
2017-11-06 12:21:52 +00:00
Bernie Stern
6029064756 HTTP/2 has no status message (#1048) (#1049) 2017-11-06 12:17:43 +00:00
Luke Bousfield
67630217ae Fix context.inspect when called on the prototype (#1012)
* Fix context.inspect when called on the prototype

Fixes #837

* Add tests
2017-07-15 20:05:26 -04:00
Martin Iwanowski
327b65cb6b Use node 7+ WHATWG parser for hostname, fixes #1002 (#1004)
* Use node 7+ WHATWG parser for hostname, fixes #1002

* only use URL if host is IPv6, expose parsed URL

* catch invalid URLs, memoize empty obj

* hostname returns empty string when URL throws
2017-06-20 09:57:30 -07:00
Martin fl0w Iwanowski
012587889d added setters for header and headers, fixes #991 2017-06-20 09:57:07 -07:00
ziyunfei
13c7ca6139 res.type=: remove no-op code (#980) 2017-05-05 10:27:11 -07:00
Thiago Lagden
ee5af59f1f replace apply by spread syntax (#971) 2017-04-23 16:14:16 -07:00
jongleberry
4816cd76f0 :arrow-up: deps
closes #939
2017-03-14 01:55:15 -07:00
Lee Bousfield
e6539e1cf2 Return middleware chain promise from callback() (#848)
The v2.x version of 8836cd3 on master.
2017-03-07 23:05:28 -08:00
jongleberry
e812339033 docs: create v2 Migration document (#931)
* Give v2 migration documentation its own document. Incorporate docs from #533

* Fix mis-capitalization of Koa

* Remove unnecessary Dependency section

* Hint at koa-convert enabled compatibility

* Add section on constructing with new

* Clarify es6 constructors are used

* Fix varying capitalization

* Restore mistakenly removed Dependency changes section

* v1.x should not receive feature updates

* Add next() to signature, add missing backticks

* docs++
2017-03-07 22:59:42 -08:00
jongleberry
e9d7abaf79 res: use http.ServerResponse._header when accessors exist (#930)
* Don't use http.ServerResponse._header when accessors exist

Structure of http.ServerResponse._header will change in future
Node versions. Avoid reading and setting it directly when
helpers exist.

* Add new header test case

* make things a little more strict
2017-03-07 22:59:24 -08:00
fengmk2
e452b68bd9 feat: set err.headerSent before app error event emit (#919) 2017-02-28 10:52:54 +08:00
Ilkka Oksanen
d740d9b2b1 Update the link to migration instructions (#916) 2017-02-26 21:41:14 +08:00
fengmk2
a7c4236728 fix: add named arrow function for request and response handlers (#805)
cherry-pick #804
2017-02-25 00:06:41 -06:00
Rui Marinho
7ae9c3e109 Fix malformed content-type header causing exception on charset get (#898) 2017-02-13 11:05:35 +08:00
iamchenxin
2db3b1b49a Fix typo for accepts(). (#863)
it return {String|Array|false}, never return undeifined.
2016-12-07 00:22:11 +08:00
Avindra Goolcharan
2a16426afe nit: fix grammar in generator deprecation warning (#834)
This fixes the tense of `will been` to `will be`
2016-10-17 17:45:06 +02:00
Adam Lau
21c0d823dd fix: subdomains should be [] if the host is an ip (#808)
Closes: #775
2016-09-07 16:21:32 +08:00
Yiyu He
4338cb6c14 [breaking change] don't bind onerror to context (#800) 2016-08-29 11:18:30 +08:00
jongleberry
2abed6ec75 fix: res.flushHeaders() (#795)
* fix: res.flushHeaders()

* remove arg to flush headers

* fix tests for node v4 and v5
2016-08-10 12:15:48 -07:00
Yiyu He
23903e7ef4 fix(response): correct response.writable logic (#782) 2016-07-24 01:20:29 +08:00
Martin Iwanowski
d47d0f9619 fix broken link, fixes #741 (#745) 2016-05-27 07:41:22 +02:00
PlasmaPower
54e58d3523 req: Cache the request IP 2016-04-03 19:30:06 -07:00
Martin Iwanowski
0ac4ff00c6 Convert generator-mw with deprecation warning 2016-03-22 07:35:05 +01:00
dead_horse
39f058e11c fix cookies' secure detect 2016-03-15 13:57:22 -07:00
Lee Bousfield
a440425dc2 Add support for headers in errors 2016-03-12 17:46:35 -07:00
Bartol Karuza
3d15c2409d JSDoc question/suggestion on optional parameters
Hi, Webstorm keeps giving me warnings on the 'redirect' method, because the JSDoc specified two input parameters, both required. There is a JSDoc standard for optional parameters. What is your view on using these in KOA documentation?
http://usejsdoc.org/tags-param.html#optional-parameters-and-default-values

closes #661
2016-03-12 14:22:42 -08:00
Louis DeScioli
d74802dc70 Standardizes instances of removeHeader to remove 2016-03-12 14:19:27 -08:00