Commit Graph

1242 Commits

Author SHA1 Message Date
Douglas Christopher Wilson
12bc16e72f tests: use supertest to check response header values
closes #2983
closes #2992
2016-05-11 08:50:38 +02:00
Linus Unnebäck
bb84cf955f tests: add test for signed cookie without secret
closes #2986
2016-05-10 11:54:52 -04:00
Douglas Christopher Wilson
7cafdb5824 Merge tag '4.13.4' 2016-01-21 21:23:07 -05:00
Douglas Christopher Wilson
e7a02f6a25 build: move repository to expressjs 2016-01-21 20:59:53 -05:00
Ricardo Bin
7a3b5aea11 tests: add test for res.send() without arguments
closes #2778
closes #2783
2015-11-07 00:25:06 -05:00
Brendan Ashworth
2f8ac6726f tests: fix redirect tests for change in 302 status message
closes #2690
2015-08-03 15:54:03 -04:00
Douglas Christopher Wilson
11a77a3fff Fix inner numeric indices incorrectly altering parent req.params 2015-08-03 01:01:16 -04:00
Douglas Christopher Wilson
ee90042d0c Fix infinite loop condition using mergeParams: true 2015-08-03 00:50:48 -04:00
Blake Embrey
e33c5035bb deps: path-to-regexp@0.1.7
closes #2717
2015-07-31 16:58:57 -04:00
Douglas Christopher Wilson
de7ffca33f tests: add test for matching route after error 2015-07-24 21:36:56 -04:00
Jeremiah Senkpiel
694869d2aa Use path-is-absolute module for absolute path detection
closes #2620
2015-07-06 23:55:17 -04:00
Douglas Christopher Wilson
cec5780db4 Use router module for routing
closes #2411
2015-07-06 23:46:00 -04:00
Douglas Christopher Wilson
21d52daafb Remove req.param() 2015-07-06 21:15:16 -04:00
Douglas Christopher Wilson
6c751191dd Remove utils.flatten 2015-07-06 21:12:44 -04:00
Douglas Christopher Wilson
1e2951a832 Remove app.param(fn) signature 2015-07-06 16:45:09 -04:00
Douglas Christopher Wilson
3a1f27fcde Remove ":" stripping from app.param() 2015-07-06 16:31:51 -04:00
Douglas Christopher Wilson
b309b873f1 Merge tag '4.13.1' 2015-07-06 16:13:54 -04:00
Douglas Christopher Wilson
7bea53b92b deps: qs@4.0.0 2015-07-06 01:20:09 -04:00
Douglas Christopher Wilson
0634e7e189 tests: add test for rendering extensionless file without view engine 2015-06-20 12:54:52 -04:00
Blake Embrey
60e2008dee deps: path-to-regexp@0.1.6
fixes #2491
fixes #2617
closes #2637
closes #2683
2015-06-19 09:59:33 -04:00
Behcet Uyar
24d1c98c0a Fix res.format error when only default provided
fixes #2665
2015-06-18 23:08:34 -04:00
Radu Dan
8da51e3acc Fix issue where next('route') in app.param would incorrectly skip values
fixes #2655
2015-06-18 22:14:37 -04:00
Douglas Christopher Wilson
3d2ecdd5fa Merge tag '3.21.0' 2015-06-18 22:10:21 -04:00
Douglas Christopher Wilson
c8d61b6269 deps: etag@~1.7.0
fixes #2667
2015-06-18 20:54:26 -04:00
Douglas Christopher Wilson
f90e045334 Merge tag '4.12.4' 2015-05-18 00:41:42 -04:00
Douglas Christopher Wilson
62d5c38575 Merge tag '3.20.3' 2015-05-18 00:12:01 -04:00
Douglas Christopher Wilson
7df8fa3be5 deps: supertest@1.0.1 2015-05-17 23:44:09 -04:00
Ignacio Carbajo
ea6e4d3b6f tests: add a missing test description
closes #2631
2015-05-01 22:12:09 -04:00
Douglas Christopher Wilson
c894c84e4a build: support io.js 1.x
closes #2539
2015-03-17 02:09:39 -04:00
Douglas Christopher Wilson
40f4ac3cb3 Merge tag '3.20.2' 2015-03-17 01:52:23 -04:00
Phat
1114ca1ab6 tests: fix assert usage mistake
fixes #2592
2015-03-17 01:19:38 -04:00
Douglas Christopher Wilson
389ab1b19f tests: add test for cookie-sessions example 2015-03-17 01:02:08 -04:00
Douglas Christopher Wilson
dbc61fc191 Fix wrong code on aborted connections from res.sendFile 2015-03-01 17:27:50 -05:00
Douglas Christopher Wilson
cd6df7699d Merge tag '3.20.1' 2015-02-28 23:29:23 -05:00
Douglas Christopher Wilson
2e0f5e7817 Fix req.host when using "trust proxy" hops count 2015-02-28 21:32:51 -05:00
Paul Serby
20aa12616a Fix req.protocol/req.secure when using "trust proxy" hops count
fixes #2569
closes #2570
2015-02-28 21:29:43 -05:00
Douglas Christopher Wilson
f6ec710534 Merge tag '4.12.0' 2015-02-23 01:00:12 -05:00
Seth Krasnianski
8fe5fd89c6 tests: fix error-handling typo
closes #2557
2015-02-22 22:30:22 -05:00
Douglas Christopher Wilson
53e5991dd1 tests: add extra setCharset tests 2015-02-18 22:57:50 -05:00
Douglas Christopher Wilson
531f024e48 Merge tag '3.20.0' 2015-02-18 22:33:47 -05:00
Douglas Christopher Wilson
b40e74d6b6 Fix "trust proxy" setting to inherit when app is mounted
fixes #2550
fixes #2551
2015-02-18 00:59:56 -05:00
Douglas Christopher Wilson
eaf3318dd3 Generate ETags for all request responses
closes #2546
2015-02-18 00:12:28 -05:00
Douglas Christopher Wilson
ca480d7043 tests: improve res.download tests 2015-02-16 17:54:36 -05:00
Douglas Christopher Wilson
8a5ecd3d89 Merge tag '4.11.1' 2015-01-21 03:58:41 -05:00
Douglas Christopher Wilson
41f8435d32 tests: fix failing test on Node.js 0.11.15 2015-01-21 03:28:57 -05:00
Douglas Christopher Wilson
82689d68cf Merge tag '3.19.1' 2015-01-21 03:24:31 -05:00
Douglas Christopher Wilson
855176b633 tests: remove more mocking uses 2015-01-21 03:17:30 -05:00
Douglas Christopher Wilson
f6f78e5f02 Add res.append(field, val) to append headers
closes #2455
2015-01-13 21:07:00 -05:00
Douglas Christopher Wilson
ec8daf0e7b Match routes iteratively to prevent stack overflows
fixes #2412
2015-01-13 15:33:54 -05:00
Douglas Christopher Wilson
935f05bc84 Fix OPTIONS responses to include the HEAD method properly
fixes #2459
2015-01-13 13:26:19 -05:00
Douglas Christopher Wilson
dab9222942 Fix crash from error within OPTIONS response handler
fixes #2494
2015-01-12 18:00:49 -05:00
Douglas Christopher Wilson
11529a2ea0 Fix OPTIONS responses to include the HEAD method property
fixes #2459
2015-01-08 23:30:42 -05:00
Douglas Christopher Wilson
12626aed35 Fix Allow header for OPTIONS to not contain duplicate methods
fixes #2458
2015-01-04 19:07:21 -05:00
Douglas Christopher Wilson
3387916efc Fix incorrect "Request aborted" for res.sendFile when HEAD or 304
fixes #2481
2015-01-04 18:26:15 -05:00
Douglas Christopher Wilson
4aa2801054 Merge tag '3.18.6' 2014-12-12 22:06:21 -05:00
Troy Goode
5d74a553d6 Fix exception in req.fresh/req.stale without response headers
fixes #2468
2014-12-12 21:17:23 -05:00
Douglas Christopher Wilson
91824514ce tests: run render tests with internal template engine 2014-11-28 09:10:44 -05:00
Douglas Christopher Wilson
4b26bbde2d Fix res.sendFile logging standard write errors
closes #2451
2014-11-24 23:28:37 -05:00
Douglas Christopher Wilson
b326ae89df Fix res.sendFile logging standard write errors
fixes #2433
2014-11-23 16:53:11 -05:00
Josemar Magalhaes
6dea32cd18 examples: add multi router example
closes #2434
2014-11-09 19:01:13 -05:00
Douglas Christopher Wilson
97ccc52207 Remove res.send(status) signature 2014-11-06 21:20:46 -05:00
Douglas Christopher Wilson
0fc4f0735a Remove res.sendfile 2014-11-06 21:03:04 -05:00
Douglas Christopher Wilson
ccdbe4ea37 Remove req.acceptsLanguage 2014-11-06 20:54:29 -05:00
Douglas Christopher Wilson
59f2b4048a Remove acceptsEncoding 2014-11-06 20:53:17 -05:00
Douglas Christopher Wilson
7f2532808a Remove req.acceptsCharset 2014-11-06 20:52:14 -05:00
Douglas Christopher Wilson
f31dcff10c Remove app.del 2014-11-06 20:44:42 -05:00
Douglas Christopher Wilson
8c6f9c4253 Remove app.router error message 2014-11-06 20:18:44 -05:00
Douglas Christopher Wilson
88103063fe Remove res.jsonp(obj, status) signature 2014-11-06 20:18:42 -05:00
Douglas Christopher Wilson
164638b24f Remove res.json(obj, status) signature 2014-11-06 20:18:40 -05:00
Douglas Christopher Wilson
e66625be50 Remove res.send(body, status) signature 2014-11-06 20:18:39 -05:00
Douglas Christopher Wilson
085a29685a Change req.host to return host 2014-11-06 20:18:37 -05:00
Aria Stewart
eabd4564aa Fix handling of URLs containing :// in the path
fixes #2421
2014-10-29 00:33:02 -04:00
Douglas Christopher Wilson
68290ee87a Fix handling of invalid empty URLs
fixes #2399
2014-10-23 21:33:38 -04:00
Douglas Christopher Wilson
6614352563 Add support for app.set('views', array)
closes #2320
2014-10-23 17:28:53 -04:00
Douglas Christopher Wilson
b1d0c19ca1 examples: make main app file names consistent
fixes #2408
2014-10-23 02:39:38 -04:00
Douglas Christopher Wilson
ccc45a74f8 Merge tag '3.18.1' 2014-10-23 02:06:20 -04:00
Douglas Christopher Wilson
af1043844f Fix internal utils.merge deprecation warnings 2014-10-22 15:18:10 -04:00
Douglas Christopher Wilson
4d1ee23f84 Use etag module to generate ETag headers 2014-10-18 00:53:17 -04:00
Douglas Christopher Wilson
6f31218ecc Use content-disposition module 2014-10-17 23:45:58 -04:00
Alex Upadhyay
6f0302fb78 Fix res.redirect body when redirect status specified
fixes #2402
fixes #2404
2014-10-17 22:00:59 -04:00
Douglas Christopher Wilson
94f10c26cb Fix using same param name in array of paths
fixes #2389
2014-10-10 16:31:09 -04:00
Douglas Christopher Wilson
728917164c Fix router.use to accept array of middleware without path 2014-09-17 19:18:13 -07:00
Douglas Christopher Wilson
bf1980f1b4 Improve error message for bad app.use arguments 2014-09-17 19:18:10 -07:00
Douglas Christopher Wilson
3c1a964362 Fix regression for empty string path in app.use
fixes #2361
fixes #2362
2014-09-17 19:18:01 -07:00
Douglas Christopher Wilson
916a75cf19 Merge tag '3.17.2' 2014-09-16 23:08:03 -07:00
Julien Gilli
80847d8c82 tests: fix broken tests with node v0.12 branch
Currently, test/req.ip.js assumes that the connection between the client
and the server is an IPv4 connection. However, depending on the
configuration of the host where this test runs, the connection can be an
IPv4 one or an IPv6 one using an IPv4 mapped address. In the future, it
could also be a "full" IPv6 connection.

This change makes this test handle any type of address.

fixes #2342
2014-09-15 21:41:34 -07:00
Douglas Christopher Wilson
cf41a8f254 Fix app.use to accept array of middleware without path
fixes #2356
2014-09-12 17:46:49 -04:00
Seth Samuel
12f92a50dc Add res.sendStatus
closes #2269
closes #2297
closes #2340
2014-09-09 00:24:11 -04:00
Douglas Christopher Wilson
51d33edb79 Use etag to generate ETag headers 2014-09-09 00:13:49 -04:00
Douglas Christopher Wilson
2a0c35a108 Invoke callback for sendfile when client aborts
fixes #2189
fixes #2300
closes #2303
closes #2305
2014-09-09 00:12:49 -04:00
Douglas Christopher Wilson
6bc7574ab5 docs: typo fixes
closes #2316
2014-09-08 23:53:21 -04:00
Douglas Christopher Wilson
3dca534995 Merge tag '3.17.1' 2014-09-08 23:48:59 -04:00
Douglas Christopher Wilson
70767b19ac Fix error in req.subdomains on empty host 2014-09-08 23:45:34 -04:00
Douglas Christopher Wilson
2de6514b4b Support IP address host in req.subdomains
fixes #2308
2014-09-08 23:04:06 -04:00
Douglas Christopher Wilson
d07c06363f Support X-Forwarded-Host in req.subdomains 2014-09-08 23:02:42 -04:00
Douglas Christopher Wilson
33bb8fc4b6 examples: fix up route-separation code
closes #2341
2014-09-08 20:51:32 -04:00
Douglas Christopher Wilson
4986b1cb4c tests: add some res.sendfile directory tests 2014-08-24 13:28:39 -04:00
Douglas Christopher Wilson
9eafaa23d8 Merge tag '3.16.7' 2014-08-18 22:54:25 -04:00
Raymond Feng
d7bef52591 build: move repository
closes #2268
closes #2270
2014-08-18 22:07:35 -04:00
Douglas Christopher Wilson
1ca01c0c47 tests: add router.use validation tests
closes #2299
2014-08-15 00:22:54 -04:00
Douglas Christopher Wilson
fbceae2716 tests: add additional res.sendFile test
closes #2298
2014-08-15 00:18:54 -04:00
Fabien Franzen
17cea29013 Support mounted app as any argument to app.use()
fixes #2277
2014-08-06 02:49:06 -04:00
Douglas Christopher Wilson
2cb029f896 Add res.sendFile
fixes #1906
closes #2266
2014-08-06 02:26:51 -04:00
Douglas Christopher Wilson
12e070e39a tests: add encoding tests for res.sendfile 2014-08-04 17:38:04 -04:00
Douglas Christopher Wilson
d8237b976b Merge tag '3.15.3' into 4.7.x 2014-08-04 17:35:42 -04:00
Douglas Christopher Wilson
e8b471ff4f fix res.sendfile regression for serving directory index files 2014-08-04 17:30:25 -04:00
Douglas Christopher Wilson
d0b6b3dfcf tests: change Route tests to use callback 2014-07-23 17:28:14 -04:00
Ashley Streb
11c74d72eb Fix req.protocol for proxy-direct connections
fixes #2252
2014-07-23 16:08:20 -04:00
Douglas Christopher Wilson
88cffadcaa deps: send@0.7.0 2014-07-23 14:54:33 -04:00
Ashley Streb
a28b7a85cf Fix req.protocol for proxy-direct connections
fixes #2252
2014-07-23 00:19:10 -04:00
Douglas Christopher Wilson
0d77305a1a Pass options from res.sendfile to send
fixes #2017
2014-07-23 00:08:15 -04:00
Douglas Christopher Wilson
e29fa25bb4 Add configurable query parser
closes #2215
2014-07-13 23:15:00 -04:00
Douglas Christopher Wilson
b43205ca98 perf: prevent multiple Buffer creation in res.send 2014-07-13 21:14:30 -04:00
Douglas Christopher Wilson
3e32721e24 Fix subapp.mountpath regression for app.use(subapp)
fixes #2233
2014-07-12 22:07:43 -04:00
Douglas Christopher Wilson
997a558a73 Accept multiple callbacks to app.use()
fixes #2224
2014-07-11 17:13:06 -04:00
Douglas Christopher Wilson
a01326adac Catch errors in multiple req.param(name, fn) handlers 2014-07-11 17:12:57 -04:00
Douglas Christopher Wilson
1c3bd36be6 Support non-string path in app.use(path, fn)
fixes #2207
2014-07-11 16:35:37 -04:00
Douglas Christopher Wilson
4ea6f21b02 Merge tag '3.14.0' 2014-07-11 16:28:37 -04:00
Douglas Christopher Wilson
ec5b9f5c61 tests: add test for error handler in route
closes #2228
2014-07-11 09:35:20 -04:00
Douglas Christopher Wilson
b2382a7336 Remove unnecessary escaping in res.jsonp 2014-07-11 00:20:11 -04:00
Douglas Christopher Wilson
f684a64df7 Add explicit "Rosetta Flash JSONP abuse" protection 2014-07-11 00:15:55 -04:00
Yad Smood
544c6665f5 Fix res.send(status, num) to send num as json
fixes #2226
2014-07-10 23:19:57 -04:00
Douglas Christopher Wilson
968b00c3d7 tests: add missing FQDN router URL tests 2014-07-08 19:40:22 -04:00
Douglas Christopher Wilson
ef497fdae4 tests: add mounting to strict routing test 2014-07-07 23:25:05 -04:00
Douglas Christopher Wilson
23a49ff61e Fix routing regression when altering req.method 2014-07-06 19:44:43 -04:00
Douglas Christopher Wilson
b4b2efee0f tests: add more app.use tests 2014-07-05 11:32:44 -04:00
Douglas Christopher Wilson
e6eeec3f03 Add req.hostname
closes #2179
2014-07-04 14:00:37 -04:00
Douglas Christopher Wilson
269dc5323f Invoke router.param() only when route matches
fixes #2206
2014-07-04 13:46:23 -04:00
Douglas Christopher Wilson
bcee730354 Merge tag '3.13.0' 2014-07-04 01:14:40 -04:00
Douglas Christopher Wilson
b601d64203 tests: fix inconsistent test 2014-07-04 00:38:59 -04:00
Douglas Christopher Wilson
ce3d1fe07e Add headers option to res.sendfile 2014-07-03 12:53:49 -04:00
Douglas Christopher Wilson
fd35351594 Add mergeParams option to Router
fixes #2153
fixes #2203
2014-07-03 01:13:09 -04:00
Douglas Christopher Wilson
0ebfc6b7bf tests: add test for OPTIONS in app.all 2014-06-23 20:35:44 -04:00
Douglas Christopher Wilson
2cccbc186e add deprecation message to non-plural req.accepts* 2014-06-23 16:17:44 -04:00
Douglas Christopher Wilson
7f26cfca91 Fix handling when route.all is only route 2014-06-22 12:02:40 -04:00
Douglas Christopher Wilson
b89a597029 Restore req.params after invoking Router
fixes #2163
2014-06-22 12:02:36 -04:00
Douglas Christopher Wilson
bdfd288eec fix behavior when handling request without routes
fixes #2159
2014-06-22 12:02:32 -04:00
Douglas Christopher Wilson
3ffceff3ed Merge tag '3.12.0' 2014-06-22 11:42:15 -04:00
刘星
e606d99dc8 Fix res.attachment Unicode filenames in Safari
closes #2188
2014-06-20 16:55:05 -04:00
Douglas Christopher Wilson
6ee9433f29 deps: update example dependencies 2014-06-20 16:43:04 -04:00
Douglas Christopher Wilson
9c731f1883 deprecate things with depd module 2014-06-19 23:34:58 -04:00
Douglas Christopher Wilson
5a4e9125de deps: connect@2.20.2 2014-06-19 23:24:07 -04:00
Douglas Christopher Wilson
6775658ed5 Fix persistence of req.params from app.params
fixes #2170
2014-06-11 18:15:09 -04:00
Douglas Christopher Wilson
3205f68510 deps: update example dependencies 2014-06-09 20:39:34 -04:00
Douglas Christopher Wilson
4d3e0d88a2 Fix catching errors from top-level handlers 2014-06-09 09:44:37 -04:00
Douglas Christopher Wilson
21393c244c tests: add more route tests 2014-06-06 11:12:52 -04:00
Douglas Christopher Wilson
4279e6ef45 improve before hook in mvc example 2014-06-06 10:42:29 -04:00
Douglas Christopher Wilson
3db6dd752f change confusing 404 handling in download example 2014-06-06 10:23:47 -04:00
Douglas Christopher Wilson
5019f38e29 tests: add more tests 2014-06-06 00:38:14 -04:00
Douglas Christopher Wilson
f433b7c7cf replace utils.escape with html-escape 2014-06-03 00:37:32 -04:00
Douglas Christopher Wilson
db4448dda8 Merge tag '3.9.0' 2014-05-30 22:17:51 -04:00
Douglas Christopher Wilson
8751d7ecf8 tests: add more tests 2014-05-30 21:28:48 -04:00
Douglas Christopher Wilson
c21226aa7c improve etag control for res.send
closes #1435
closes #2129
2014-05-30 21:02:21 -04:00
Douglas Christopher Wilson
3e358458f4 tests: add more etag tests 2014-05-30 19:51:32 -04:00
Douglas Christopher Wilson
766b3aecf7 deps: update example dependencies 2014-05-29 23:39:52 -04:00
Douglas Christopher Wilson
8ab96ab80d mark res.send ETag as weak and reduce collisions 2014-05-29 23:14:21 -04:00
Douglas Christopher Wilson
1f2e00ef8d deps: should@~4.0.0 2014-05-29 22:53:59 -04:00
Douglas Christopher Wilson
b49453cf0d update send to 0.4.0
closes #2150
2014-05-29 22:32:03 -04:00
Tiago Relvao
3c0ec59432 Include ETag in HEAD requests
backport of commit 3c7310ebcb
2014-05-28 22:31:00 -04:00
Douglas Christopher Wilson
d4a2843500 tests: add param test with encoded value
closes #2143
2014-05-28 22:30:24 -04:00
Douglas Christopher Wilson
fb2d918056 fix handling of errors from param callbacks
fixes #2149
2014-05-28 22:26:05 -04:00
Douglas Christopher Wilson
e7ad49bbbe tests: add accepts test with params 2014-05-28 00:30:29 -04:00
Douglas Christopher Wilson
ad9a414fae tests: add more acceptance tests 2014-05-28 00:24:24 -04:00
Douglas Christopher Wilson
c3470c9c96 tests: add route ordering test 2014-05-23 18:46:00 -04:00
Douglas Christopher Wilson
7f049164b7 Revert "fix behavior of multiple app.VERB for the same path"
This reverts commit 31b2e2d7b4.

fixes #2133
2014-05-23 18:35:20 -04:00
Douglas Christopher Wilson
db4a061ed6 Merge tag '3.8.0' 2014-05-21 02:08:04 -04:00
Douglas Christopher Wilson
f14e39d451 set proper charset in content-type for res.send
This will write strings to sockets with an explicit "utf8" encoding
(which is the default) and will override the charset in the
Content-Type so it properly relfects the encoding of the response.

closes #1631
closes #2092
2014-05-21 01:31:08 -04:00
Alberto Leal
084f5d891b Keep previous Content-Type for res.jsonp
backport of commit be997fd654
2014-05-21 01:04:29 -04:00
Douglas Christopher Wilson
8d7d80ef9d tests: add more tests of web-service example 2014-05-21 00:08:17 -04:00
Douglas Christopher Wilson
cf5de082b5 tests: add more tests of cookies example 2014-05-21 00:08:06 -04:00
Douglas Christopher Wilson
1944451082 tests: add more tests of negotiation example 2014-05-20 23:50:58 -04:00
Douglas Christopher Wilson
602e5a8200 tests: add more tests of mvc example 2014-05-20 23:41:09 -04:00
Douglas Christopher Wilson
83b8b7acb7 tests: add more various tests 2014-05-20 23:25:51 -04:00
Douglas Christopher Wilson
e660f19507 tests: add req.acceptsLanguage tests 2014-05-20 23:13:29 -04:00
Douglas Christopher Wilson
ff412b927d tests: add req.acceptsEncoding tests 2014-05-20 23:08:01 -04:00
Douglas Christopher Wilson
392ef1eb06 tests: add more app.render tests 2014-05-20 22:57:00 -04:00
Douglas Christopher Wilson
e7e2592357 tests: add more app.param tests 2014-05-20 10:58:39 -04:00
Douglas Christopher Wilson
739586f96a add req.baseUrl to access stripped path in routes
fixes #2078
2014-05-19 00:39:26 -04:00
Douglas Christopher Wilson
23ff74bb3f tests: flow control with after 2014-05-18 16:33:11 -04:00
Douglas Christopher Wilson
98d17e2293 invoke router.param() only when necessary
fixes #2121
2014-05-18 16:21:01 -04:00
Douglas Christopher Wilson
ababa6ae5b fix issue routing requests among sub routers
fixes #2121
2014-05-18 15:27:28 -04:00
Douglas Christopher Wilson
097cd0c242 Merge tag '3.7.0' 2014-05-18 11:21:30 -04:00
Douglas Christopher Wilson
1f938c560a tests: improve examples/auth tests 2014-05-18 01:54:05 -04:00
Douglas Christopher Wilson
1717516a78 build: improve platform portability 2014-05-18 01:14:45 -04:00
Jonathan Ong
328c6d3060 remove unnecessary test/support/http
backport of 643397ed21
2014-05-18 00:57:54 -04:00
Douglas Christopher Wilson
566720be15 improve proxy trust with ip address list
closes #2099
2014-05-17 20:02:20 -04:00
Douglas Christopher Wilson
65f13c3cc6 update connect to 2.16.1 2014-05-17 14:30:52 -04:00
Douglas Christopher Wilson
31b2e2d7b4 fix behavior of multiple app.VERB for the same path
fixes #2116
2014-05-16 15:09:42 -04:00
Douglas Christopher Wilson
35c50601bd Merge tag '3.6.0' 2014-05-09 17:33:26 -04:00
Douglas Christopher Wilson
bc9bcb0317 Fix req.next when inside router instance
fixes #2016
2014-05-09 16:53:15 -04:00
Douglas Christopher Wilson
e4302b2120 tests: fixup new json tests 2014-05-08 23:22:18 -04:00
Douglas Christopher Wilson
920f46ad65 tests: add more res.jsonp? tests 2014-05-08 21:27:01 -04:00
Douglas Christopher Wilson
35a66d8a14 tests: add test for res.format in route
closes #2016
2014-05-08 21:15:48 -04:00
Douglas Christopher Wilson
4e1e252e17 deprecate res.json(obj, status)
closes #2106
closes #2107
2014-05-08 21:11:05 -04:00
Douglas Christopher Wilson
a8bb4bab2b tests: add test for app.delete 2014-05-08 16:40:28 -04:00
Douglas Christopher Wilson
0bbbc84959 Merge branch '4.1.x' 2014-05-08 14:45:47 -04:00
Douglas Christopher Wilson
2901bd6916 Merge branch '3.5.x' into 4.1.x 2014-05-08 14:01:02 -04:00
Douglas Christopher Wilson
d58ca520c8 Fix res.jsonp error if callback param is object
fixes #2104
2014-05-08 13:42:19 -04:00
Douglas Christopher Wilson
c99fa6a192 Fix req.host for IPv6 literals
fixes #2102
2014-05-07 14:08:08 -04:00
Alberto Leal
be997fd654 Keep previous Content-Type for res.jsonp
closes #2094
2014-05-02 15:01:19 -04:00
Douglas Christopher Wilson
5c3852b91c tests: remove unused image fixture
closes #2091
2014-05-02 09:00:36 -04:00
Tiago Relvao
3c7310ebcb Include ETag in HEAD requests
fixes #2083
2014-04-30 09:34:10 -04:00
Douglas Christopher Wilson
203fb05d3e update example dependencies 2014-04-24 17:05:20 -04:00
Douglas Christopher Wilson
2fd3e72a19 Pass options from res.sendfile to send
fixes #2017
2014-04-24 16:44:06 -04:00
Andy VanWagoner
56b672e657 support non-ascii filenames in content-disposition headers 2014-04-19 21:16:11 -06:00
Ke Zhu
19983272f3 improve req.xhr test by verifying status code 2014-04-15 00:11:20 -04:00
Roman Shtylman
d72f27909f handle thrown errors inside Route
close #2029
2014-04-08 14:50:26 -04:00
Roman Shtylman
cb1fbce46b don't call done twice for thrown errors inside parameterized routes
fixes #1995
2014-03-23 14:42:46 -04:00
Blake Embrey
efbe1779e3 Override params every layer. 2014-03-17 15:16:26 -03:00
Blake Embrey
c7e84d8044 Clean up code and syntax issues. 2014-03-10 13:19:03 -04:00
Blake Embrey
51e80ffd48 Add tests for dynamic mounting. 2014-03-10 13:16:39 -04:00
Jonathan Ong
68996d7561 remove req.auth 2014-03-09 19:45:43 -07:00
Jonathan Ong
2064f412cb remove res.charset usage 2014-03-07 16:46:54 -08:00
Jonathan Ong
bad55f7977 move setHeader charset patch to .set
note that application/json no longer adds charset=utf-8. could be a
regression.

closes #1952
See also: https://github.com/broofa/node-mime/issues/86
2014-03-07 16:32:41 -08:00
Jonathan Ong
3cf7b2e39e refactor to use basic-auth 2014-03-07 16:18:51 -08:00
Jonathan Ong
643397ed21 remove unnecessary test/support/http 2014-03-05 22:06:14 -08:00
Jonathan Ong
85bf9ab76a uncomment a commented out test
lol @visionmedia
2014-03-05 22:01:36 -08:00
Roman Shtylman
d368aed150 fix Route#all before Route#verb
Properly handle calling a VERB after using .all()

close #1945
2014-03-03 17:50:13 -05:00
Roman Shtylman
f8b954bcd9 make express.Router() return a Router function instance
Similar to how express() returns an express `app` instance which is also
a function, express.Router() returns the Router instance which is also a
function and can be easily used via another router or the app.

app.use(express.Router());
2014-02-26 20:22:11 -05:00
Roman Shtylman
6911815171 Router: add parameter handling to middleware
Middleware (.use) can now specify parameter arguments to trigger
Router.param loading. This is handy if you want to `.use` additional
routers but need to load certain objects before the mounted middleware
runs.
2014-02-23 19:21:13 -05:00
Roman Shtylman
0719e5f402 implement app.route() 2014-02-23 11:31:43 -05:00
Roman Shtylman
d42d8f5b07 move support for multiple res.cookie calls to lib/response
Patch.js is simpler and follows upstream node.js closer as a result.
2014-02-22 09:26:30 -05:00
Roman Shtylman
6835289564 remove ServerResonse.headerSent monkey patch
node.js ServerResponse contains a headersSent field. Use that instead of
our patched misnamed version.
2014-02-22 09:26:29 -05:00
Roman Shtylman
1396e0855d remove last pieces of connect dependency
- copy over patch.js to shim ServerResponse
- bundle `static` middleware
2014-02-22 09:26:29 -05:00
Jonathan Ong
0796c1d2d2 test app.router: ignore connect method
so tests pass in 0.11. 0.11 client seems to throw errors more often, so
this is not an issue with express or node’s servers.
2014-02-08 11:39:26 -08:00
Jonathan Ong
aac1d52c4f res.location: remove resolving relative urls
closes #1804

this is an unnecessary maintenance burden (see the number of removed
tests), especially when supporting mounting. browsers handle relative
locations, and so should all clients.

a regression could be absolute locations on a mounted app, but 1. we
can fix that later when someone complains and 2) code-smell
2014-02-08 11:37:43 -08:00
Roman Shtylman
f41d09a3cf remove app.router and refactor middleware processing
This is an overhaul of middleware processing, Router and Route. Connect is no
longer used to process the middleware stack. This functionality has been
split into two parts: middleware stack and default error response.

The entry point for request processing is the `app.handle` method. It
sets up the default error response handle (to run in the event of no
other error handler) and then triggers the app router (instance of
Router) to handle the request.

The app router `handle` function contains the middleware dispatch layer
previously in the connect codebase. This layer handle the logic for
dispatching `.use` calls (stripping paths if needed). The app contains a
base router `app._router`. New routes can be created and `.use`d on this
router to organize routes into files.

Routers now have the following methods `.use`, `.all`, `.param` which
are all public.

Additionally, Routers have a `.route(path)` method which returns a new
instance of Route for the requested path. Route(s) are isolated
middleware stacks and contain methods for the HTTP verbs as well as an
`.all` method to act similar to middleware. These methods are chainable
to easily describe requirements for a route.

  var route = Router.route('/foo'); // or 'app.route('/foo')'

  route
  .all(auth)
  .get(function(...) {})
  .all(more_checks)
  .post(function(...) {})

Any Route and Router methods which accept handlers also accept error
(arity 4) handlers which will also behave as expected.

Finally, the `app.router` getter has been removed. Middleware and
handlers are run IN THE ORDER they are seen in the file. This means that
code which injected the `app.router` and then added error handlers (or
other middleware) will need to be updated to move those handlers after
any requests added on the app object. The examples have been updated
accordingly. This is the largest breaking change to codebases in this
commit.
2014-02-03 15:59:52 -05:00
Roman Shtylman
4983c38298 change res.locals to a plain js object.
Anyone who wants something fancier should use modules.

- fixes annoyance with not being able to set 'name' property on locals
2014-01-27 19:17:29 -05:00
Roman Shtylman
63c6a9c5ad use escape-html module to escape html
Another util bites the dust.
2014-01-24 19:21:21 -05:00
Roman Shtylman
718e68ffae use utils-merge module to mixin object properties 2014-01-24 19:16:37 -05:00
Jonathan Ong
121f8d02f3 Merge pull request #1889 from vesln/send-null-undefined
update the tests to show a difference between `send(null)` and `send(und...
2014-01-14 09:17:04 -08:00
Doug Patti
1d97599f8b prevent incorrect automatic OPTIONS responses
The router has automatic handling of OPTIONS based on the registered
routes, but if you make an OPTIONS request for an endpoint that does
not exist, then it will still return a 200 with nothing allowed.
Instead, we can let the request move on down the middleware chain. This
has two benefits: first, if the route was not defined and no other
middleware handles it, it will return with a 404. Secondly, if multiple
routers are used and a later one has the route or a custom OPTIONS
defined, the first router will not respond incorrectly.
2014-01-13 20:46:07 -08:00
Roman Shtylman
5ddbb6965f Merge pull request #1868 from dpatti/smarter-router-auto-options
Automatic OPTIONS response breaks with multiple routers
2014-01-13 14:45:06 -08:00
Doug Patti
a3b5f6d07f prevent incorrect automatic OPTIONS responses
The router has automatic handling of OPTIONS based on the registered
routes, but if you make an OPTIONS request for an endpoint that does
not exist, then it will still return a 200 with nothing allowed.
Instead, we can let the request move on down the middleware chain. This
has two benefits: first, if the route was not defined and no other
middleware handles it, it will return with a 404. Secondly, if multiple
routers are used and a later one has the route or a custom OPTIONS
defined, the first router will not respond incorrectly.
2014-01-13 17:40:42 -05:00
Roman Shtylman
7282b50ad0 remove app.configure() 2014-01-11 10:53:54 -05:00
Roman Shtylman
8c059469fd No 'json spaces' by default
Json rendering can be handled by user tools or overridden in their own
app to behave as desired. Minimizes the use of magic env settings.
2014-01-11 10:53:36 -05:00
Veselin Todorov
a36eeb96f3 update the tests to show a difference between send(null) and send(undefiend) 2014-01-03 19:47:57 +02:00
Jonathan Ong
3f14b4de1f Merge pull request #1835 from visionmedia/change-req-params-to-object
change req.params to an object instead of an array
2014-01-03 03:00:13 -08:00
Jonathan Ong
cec0c06a70 refactor req.is and req.accepts* 2014-01-03 02:50:09 -08:00
Matt Copperwaite
fcbe53ddb5 Added appropriate test for more descriptive render error 2013-12-21 17:34:59 +00:00
Alex Kocharin
7b0dca0f9c throw 400 in case of malformed paths 2013-12-11 17:14:44 -08:00
TJ Holowaychuk
c6c71abf4d change req.params to an object instead of an array 2013-11-27 19:46:39 -08:00
Roman Shtylman
f47c0d9774 add Router.all() method
Similar to app.all() but specifically for attaching handlers to all
methods under a standalone router. This is useful for isolating routers
that require "middleware" like features for all routes managed by the
router.
2013-11-19 18:52:04 -05:00
Jonathan Ong
373fa55981 fix markdown example test
marked 0.2.10 adds ids to header elements now.
2013-11-09 19:08:25 -08:00
Jérémy Lal
c9865b821d Test location with leading ./ and containing .. 2013-11-02 02:28:54 +01:00
Jérémy Lal
9c0de23645 Update tests expectancy of location headers 2013-11-02 02:28:49 +01:00
Jonathan Ong
2e197e2b98 be less picky with ENOENT errors in tests
closes #1580
2013-10-30 20:37:01 -07:00
Jonathan Ong
55d1a4f964 always send ETag when content-length > 0
closes #1780
2013-10-30 20:34:16 -07:00
Jonathan Ong
18264403b1 bump supertest to 0.8.1 2013-10-28 15:24:48 -07:00
Jonathan Ong
e218377a3d check existence of jsonp callback 2013-10-15 12:39:32 -07:00