Commit Graph

861 Commits

Author SHA1 Message Date
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