Commit graph

214 commits

Author SHA1 Message Date
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
TJ Holowaychuk
439f051776 Merge pull request #570 from koajs/fix-app-inspect
fix Application.inspect() – missing .proxy value. Closes #563
2015-10-31 11:15:09 -07:00
TJ Holowaychuk
308ceee47d Merge pull request #574 from stojanovic/fix/test-todo
Remove TODO from the response type test
2015-10-31 06:10:16 -07:00
Slobodan Stojanovic
275356a5ce Remove TODO from the response type test 2015-10-31 14:01:26 +01:00
blaz
3560651bbc Add usage of koa-convert for legacy middleware
closes #565
closes #538
2015-10-30 20:20:00 -07:00
TJ Holowaychuk
aa1fbbff4a fix Application.inspect() – missing .proxy value. Closes #563
fix trailing comma
2015-10-29 09:56:15 -07:00
Slobodan Stojanovic
b08facb7bd Fix indentation and add .eslint rules
closes #555
2015-10-29 09:55:34 -07:00
Felix Becker
ebb4850709 Remove co dependency
closes #558
closes #557

Change tests to use plain functions and promises

Add test

return promise in middleware

Change benchmarks to use plain functions and promises

typeerror
2015-10-27 16:24:25 -07:00