Commit graph

241 commits

Author SHA1 Message Date
5a9a3f0dc2 Remove is-type and replace with a helper function :) 2019-10-12 14:31:02 +00:00
141d91b216 Add back support for accepts without using npm accepts 2019-10-12 04:30:06 +00:00
8157e9e752 Remove koa-compose as as it can just be included in koa 2019-10-12 00:55:24 +00:00
d655f208cb Remove destroy, encoder, error-inject, escape-html, koa-is-json, on-finished, type-is and vary 2019-10-12 00:17:22 +00:00
6b27b844ff Add fast parse and remove parseurl 2019-10-11 19:41:53 +00:00
dd35564df4 Remove statuses and replace http-errors with http-errors-lite 2019-10-11 16:40:06 +00:00
28fee01c3f Remove delegates, dead, is-generator-function, kia-convert and only 2019-10-09 00:32:09 +00:00
c9459b19ba Remove cookies, replace debug with debug-ms 2019-10-08 18:44:33 +00:00
2ef7846b5f Remove accepts, cache-content-type and content-type.
Replace content-disposition with one that doesn’t use safe-buffer
2019-09-29 19:17:14 +00:00
fengmk2
54e8fab3e3
fix: encode redirect url if not already encoded (#1384)
Same bug from express 76eaa326ee
2019-09-28 12:49:57 +08:00
Robert Nagy
817b498305 test: fix body test (#1375)
Setting body will set the content-length header. Unless the
corresponding number of bytes are sent the response will
be aborted and not emit 'end'.
2019-08-23 18:57:56 +08:00
Robert Nagy
f75d445535 test: fix end after end (#1374) 2019-08-23 18:57:32 +08:00
Jake
5afff89eca feat: accept options in the Application constructor (#1372) 2019-08-19 10:44:09 +08:00
Yiyu He
2c86b10fea
test: remove jest and use egg-bin(mocha) (#1363) 2019-07-30 18:00:43 +08:00
dead-horse
d4bdb5ed9e chore: update eslint and fix lint errors 2019-06-26 11:15:22 +08:00
Vern Brandl
04e07fdc62 test: Buffer() is deprecated due to security and usability issues. so use the Buffer.alloc() instead (#1321) 2019-04-16 18:05:18 +08:00
Martin Iwanowski
b7bfa7113b feat: change set status assert, allowing valid custom statuses (#1308) 2019-01-28 16:50:27 +08:00
André Cruz
99051992a9 fix: Status message is not supported on HTTP/2 (#1264) 2018-11-10 01:41:21 +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
162a5b3e78 perf: lazy init cookies and ip when first time use it (#1216) 2018-07-11 11:18:39 +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
ee1a933096 fix: Throw a TypeError instead of a AssertionError (#1199) 2018-06-06 12:55:20 +08:00
Ruben Bridgewater
13086d2fcd fix tests: remove unnecessary assert doesNotThrow and api calls (#1170)
* tests: fix error verification

So far the error message was not tested at all. This change makes
sure the error will actually be tested for.

* tests: remove unnecessary api calls

`assert.doesNotThrow` does not provide any benefit since it will
only catch errors and then rethrow in case of an error.
2018-04-09 19:36:52 -07: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
Bernie Stern
6029064756 HTTP/2 has no status message (#1048) (#1049) 2017-11-06 12:17:43 +00:00
JamesWang
77ca4290a1 test: replace request(app.listen()) with request(app.callback()) 2017-09-25 23:07:57 -05:00
jongleberry
86ab4ae84a Revert "refactor: remove duplicate assignment in respond test (#1055)" (#1056)
This reverts commit c161c0f2e9.
2017-09-11 21:35:13 -05:00
Clark Du
c161c0f2e9 refactor: remove duplicate assignment in respond test (#1055)
Signed-off-by: Clark Du <clark.duxin@gmail.com>
2017-09-11 10:22:34 -07: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
Martin fl0w Iwanowski
f6f1ab73e1 lint: commit --fix 2017-06-20 09:57:07 -07:00
Gilles De Mey
d394724200 test: Use Jest (#981) 2017-05-11 11:30:32 +08:00
joehecn
9248660efd test: fix spelling error (#972) 2017-04-29 10:30:24 +08:00
joehecn
1b3e08e046 test: change a describe to it (#963) 2017-04-20 10:43:06 +08:00
joehecn
19fc4194b7 Test: change a describe to it (#959) 2017-04-16 22:02:32 -06:00
Martin Iwanowski
3721f6be0b test: remove redudant test case (#956) 2017-04-12 23:41:38 -06:00
Fangdun Cai
18d753ca2d use Buffer.from instead (#946) 2017-03-20 14:48:37 +08:00
jongleberry
4816cd76f0 :arrow-up: deps
closes #939
2017-03-14 01:55:15 -07: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
jongleberry
9671add57d test: remove babel tests as they are no longer needed in node v7.6 2017-02-25 00:05:25 -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