Commit Graph

55 Commits (master)

Author SHA1 Message Date
Jonatan Nilsson dd35564df4 Remove statuses and replace http-errors with http-errors-lite 2019-10-11 16:40:06 +00:00
Jonatan Nilsson c9459b19ba Remove cookies, replace debug with debug-ms 2019-10-08 18:44:33 +00: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
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
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
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
JamesWang 77ca4290a1 test: replace request(app.listen()) with request(app.callback()) 2017-09-25 23:07:57 -05: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
Gilles De Mey d394724200 test: Use Jest (#981) 2017-05-11 11:30:32 +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
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
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
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
Slobodan Stojanovic cc1d41f5e3 Refactor tests - add arrow functions
Refactor tests - move .should to the same line as arrow function
2015-10-25 13:26:36 -07:00
jongleberry 2e8cdab8bc support async functions
closes #530
closes #415
2015-10-22 16:34:59 -07:00
Michaël Zasso b5c09a1719 test: fix style issues 2015-10-13 09:23:57 +02:00
Tejas Manohar 93ade5e2dd refactor Application into a class 2015-10-13 01:19:42 -05:00
Tejas Manohar e8f79d43f9 modularize tests for application
closes #517

add index test for Application

add app.toJSON test

add test for app.inspect()

add tests for app.use()

add tests for app.onerror()

add tests for app.respond()

add tests for app.context()

add tests for app.request()

add tests for app.response

refactor for non-existence of test/app...js

no need for *.js

use helpers/ dir for non-tests
2015-10-12 00:08:06 -07:00
Tejas Manohar 9f27c1c414 refactor to use ES6 const
change var to const for static require()'d modules

make constant var references in app use const keyword

refactor context to use es6 constants

refactor request to use es6 constants, let block-scope coming next

use const in response object for static refs

make context tests use es6 constants

experimental unit tests -> const

use const for static references in unit test over req

use const for static refs in res tests

update app tests to use const for static refs

make the context test use es6 constants for static refs

use constants in the README
es6 constants seem to work in --harmony on 0.12 too

use const's for immutable refs in benchmarks

ensure all JS files have blank newline at top

add newline to bottom of file where missing

add a webchat freenode link to irc channel

no need to assign error in catch{}-able test

app.silent option to turn off err logging

keep test env logging for backwards-compat
2015-10-11 21:22:33 -07:00
Tejas Manohar 0b1b49cb8a use strict in all .js files
closes #508
2015-10-11 16:08:32 -07:00
dead_horse b6aea969f8 non-error thrown, fixed #432 2015-04-14 10:34:55 +08:00
HanHor Wu a04183aae0 remove the 'x-powered-by' in context test since it has been removed 2014-12-08 09:39:51 +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 193eadbdb5 add the missing semicolon 2014-11-16 23:18:37 +08:00
dead_horse eff4886cd8 ocd 2014-11-16 21:52:14 +08:00
dead_horse efdd7d3716 less strict for status, close #350
add res.message[=]
2014-10-09 23:20:53 +08:00
Jonathan Ong 2f0fe55ae3 .throw() -> http-errors, .assert() -> http-assert 2014-09-20 10:46:28 -07:00
Tiago Ribeiro a85f580983 Add full coverage 2014-09-08 23:53:46 +01: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
Ian Storm Taylor dc0c35471c support errors and update docs 2014-08-12 13:22:33 -07:00
Ian Storm Taylor 5931714bd8 make the second argument to throw properly optional 2014-08-12 13:19:14 -07:00
dead_horse f6626967b2 ignore props.status in ctx.throw 2014-08-09 13:38:54 +08:00
Ian Storm Taylor bcac468f7c add the ability to pass `props` to `context.throw` 2014-08-08 12:37:04 -07:00
dead_horse fa5948cca3 do not expose when err.status not valid 2014-08-08 10:02:24 +08:00
dead_horse e2f61595b8 fix err.status invalid lead to uncaughtException 2014-08-06 21:32:35 +08:00
dead_horse 6a2ed3e6eb assert object type in ctx.onerror 2014-04-25 08:34:11 +08:00
Jonathan Ong 182f9d6fa4 refactor: use statuses 2014-03-12 18:29:14 -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
Jonathan Ong 2d1147ed21 context.onerror: fix response handling
closes #199
2014-01-24 14:29:57 -08:00
TJ Holowaychuk 0610a841df change ctx.throw() to no longer .expose 5xx errors. Closes #197 2014-01-20 18:44:07 -08:00
Veselin Todorov 6cd4c776f8 context.throw supports Error instances 2014-01-04 10:28:24 +02:00
TJ Holowaychuk 87c03aff61 add support for .throw(status, msg). Closes #130 2013-12-20 15:34:16 -08:00
TJ Holowaychuk 5c50b6d0b3 rename error.js to throw.js 2013-12-20 15:32:02 -08:00
TJ Holowaychuk e78349a73d refactor ctx.toJSON() to recurse. Closes #108 2013-12-02 09:08:01 -08:00