Commit graph

221 commits

Author SHA1 Message Date
小雷
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
iamchenxin
fabf5864c6 Amend typo, request.is() return null|fasle|string. (#864)
Modifying the test for `null` from `==` to `===` to make sure it must be `null`.
2016-12-01 18:16:02 +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
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
dead_horse
a1cdbdafcf docs: update babel setup
closes #783
2016-07-24 01:50:17 +08:00
Yiyu He
23903e7ef4 fix(response): correct response.writable logic (#782) 2016-07-24 01:20:29 +08:00
Yu Qi
c979056087 fix tests on node 6
parsed querystrings no longer inherit from the Object prototype
2016-04-30 09:19:29 +02:00
PlasmaPower
54e58d3523 req: Cache the request IP 2016-04-03 19:30:06 -07:00
jongleberry
be87ef8a24 lint: upgrade packages, fix generator star spacing 2016-03-28 14:21:05 -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
Lee Bousfield
6a147726bd Add support for flushing headers 2016-03-03 21:01:56 -07:00
Yanick Rochon
d134fff9e8 Fix issue when app.use() is called with empty value 2015-11-25 12:10:55 +08:00
jongleberry
65f645d341 use babel-plugin-transform-async-to-generator 2015-11-06 09:40:44 -08:00
jongleberry
eb0bd4c2c3 test: fix use-strict typo 2015-11-06 09:38:00 -08:00
jongleberry
a6547bcbce ⬆️ babel and use async arrow functions 2015-11-05 08:49:20 -08:00
jongleberry
09ada29881 test: add a babel example 2015-11-05 08:47:08 -08:00
dead_horse
08057e386a ensure parseurl always working as expected 2015-11-04 15:08:49 +08:00
broucz
4b1a1da652 test: switch all functions to arrow functions
closes #553

Update test: application -> use() should throw if not a function

Fix lint

Use arrow function

Refactor test using arrow function

Remove non mandatory brackets

fix for merge

Fix: missing refactor after merge

Use arrow function for old generator
2015-11-02 11:22:05 -08:00