vulcan 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vulcan/cli.rb +20 -10
- data/lib/vulcan/version.rb +1 -1
- data/server/Procfile +1 -1
- data/server/bin/web +10 -0
- data/server/lib/cloudant.coffee +20 -0
- data/server/lib/logger.coffee +17 -0
- data/server/lib/on.coffee +10 -0
- data/server/lib/spawner.coffee +65 -0
- data/server/node_modules/coffee-script/CNAME +1 -0
- data/server/node_modules/coffee-script/LICENSE +22 -0
- data/server/node_modules/coffee-script/README +51 -0
- data/server/node_modules/coffee-script/Rakefile +78 -0
- data/server/node_modules/coffee-script/bin/cake +7 -0
- data/server/node_modules/coffee-script/bin/coffee +7 -0
- data/server/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/server/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
- data/server/node_modules/coffee-script/lib/coffee-script/cake.js +111 -0
- data/server/node_modules/coffee-script/lib/coffee-script/coffee-script.js +167 -0
- data/server/node_modules/coffee-script/lib/coffee-script/command.js +500 -0
- data/server/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
- data/server/node_modules/coffee-script/lib/coffee-script/helpers.js +77 -0
- data/server/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/server/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
- data/server/node_modules/coffee-script/lib/coffee-script/nodes.js +2986 -0
- data/server/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/server/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
- data/server/node_modules/coffee-script/lib/coffee-script/repl.js +261 -0
- data/server/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
- data/server/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
- data/server/node_modules/coffee-script/package.json +55 -0
- data/server/node_modules/connect-form/History.md +0 -6
- data/server/node_modules/connect-form/lib/connect-form.js +2 -4
- data/server/node_modules/connect-form/node_modules/formidable/Readme.md +64 -36
- data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +5 -1
- data/server/node_modules/connect-form/node_modules/formidable/package.json +20 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/common.js +5 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/funkyfilename.txt +1 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +1 -1
- data/server/node_modules/connect-form/node_modules/formidable/test/{slow → integration}/test-fixtures.js +38 -33
- data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/run.js +1 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/unit/test-incoming-form.js +63 -0
- data/server/node_modules/connect-form/package.json +27 -5
- data/server/node_modules/cradle/README.md +10 -10
- data/server/node_modules/cradle/lib/cradle.js +117 -523
- data/server/node_modules/cradle/lib/cradle/database/attachments.js +120 -0
- data/server/node_modules/cradle/lib/cradle/database/changes.js +56 -0
- data/server/node_modules/cradle/lib/cradle/database/documents.js +215 -0
- data/server/node_modules/cradle/lib/cradle/database/index.js +65 -0
- data/server/node_modules/cradle/lib/cradle/database/views.js +125 -0
- data/server/node_modules/cradle/node_modules/follow/LICENSE +202 -0
- data/server/node_modules/cradle/node_modules/follow/README.md +164 -0
- data/server/node_modules/cradle/node_modules/follow/Rakefile +54 -0
- data/server/node_modules/cradle/node_modules/follow/api.js +35 -0
- data/server/node_modules/cradle/node_modules/follow/browser/eventemitter2.js +453 -0
- data/server/node_modules/cradle/node_modules/follow/browser/export.js +78 -0
- data/server/node_modules/cradle/node_modules/follow/browser/index.html +14 -0
- data/server/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js +18 -0
- data/server/node_modules/cradle/node_modules/follow/browser/log4js.js +46 -0
- data/server/node_modules/cradle/node_modules/follow/browser/main.js +92 -0
- data/server/node_modules/cradle/node_modules/follow/browser/querystring.js +28 -0
- data/server/node_modules/cradle/node_modules/follow/browser/request.jquery.js +237 -0
- data/server/node_modules/cradle/node_modules/follow/browser/require.js +33 -0
- data/server/node_modules/cradle/node_modules/follow/browser/util.js +28 -0
- data/server/node_modules/cradle/node_modules/follow/cli.js +101 -0
- data/server/node_modules/cradle/node_modules/follow/lib/feed.js +556 -0
- data/server/node_modules/cradle/node_modules/follow/lib/index.js +66 -0
- data/server/node_modules/cradle/node_modules/follow/lib/stream.js +305 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE +55 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/README.md +285 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/main.js +618 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js +146 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js +34 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/package.json +42 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png +0 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh +6 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js +57 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js +90 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js +29 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js +90 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js +30 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js +109 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js +167 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js +39 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js +87 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js +19 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js +55 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js +72 -0
- data/server/node_modules/cradle/node_modules/follow/package.json +45 -0
- data/server/node_modules/cradle/node_modules/follow/test/couch.js +153 -0
- data/server/node_modules/cradle/node_modules/follow/test/follow.js +136 -0
- data/server/node_modules/cradle/node_modules/follow/test/issues.js +178 -0
- data/server/node_modules/cradle/node_modules/follow/test/issues/10.js +24 -0
- data/server/node_modules/cradle/node_modules/follow/test/stream.js +493 -0
- data/server/node_modules/cradle/node_modules/request/LICENSE +55 -0
- data/server/node_modules/cradle/node_modules/request/README.md +287 -0
- data/server/node_modules/cradle/node_modules/request/forever.js +103 -0
- data/server/node_modules/cradle/node_modules/request/main.js +913 -0
- data/server/node_modules/cradle/node_modules/request/mimetypes.js +152 -0
- data/server/node_modules/cradle/node_modules/request/oauth.js +34 -0
- data/server/node_modules/cradle/node_modules/request/package.json +42 -0
- data/server/node_modules/cradle/node_modules/request/tests/googledoodle.png +0 -0
- data/server/node_modules/cradle/node_modules/request/tests/run.js +38 -0
- data/server/node_modules/cradle/node_modules/request/tests/server.js +82 -0
- data/server/node_modules/cradle/node_modules/request/tests/squid.conf +77 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf +20 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl +0 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt +17 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr +13 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key +18 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl +1 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf +19 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt +16 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr +11 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js +28 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key +9 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt +16 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/test.crt +15 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/test.key +15 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-body.js +95 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-cookie.js +29 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-cookiejar.js +90 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-defaults.js +68 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-errors.js +37 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-headers.js +52 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-httpModule.js +94 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-https-strict.js +97 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-https.js +86 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-oauth.js +117 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-params.js +92 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-pipes.js +202 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-proxy.js +39 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-qs.js +28 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-redirect.js +154 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-timeout.js +87 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-toJSON.js +14 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-tunnel.js +61 -0
- data/server/node_modules/cradle/node_modules/request/tunnel.js +229 -0
- data/server/node_modules/cradle/node_modules/request/uuid.js +19 -0
- data/server/node_modules/cradle/node_modules/request/vendor/cookie/index.js +65 -0
- data/server/node_modules/cradle/node_modules/request/vendor/cookie/jar.js +72 -0
- data/server/node_modules/cradle/node_modules/vargs/package.json +33 -10
- data/server/node_modules/cradle/package.json +50 -12
- data/server/node_modules/cradle/test/cache-test.js +1 -4
- data/server/node_modules/cradle/test/connection-test.js +179 -0
- data/server/node_modules/cradle/test/database-attachment-test.js +344 -0
- data/server/node_modules/cradle/test/database-cache-test.js +132 -0
- data/server/node_modules/cradle/test/database-test.js +219 -0
- data/server/node_modules/cradle/test/database-view-test.js +141 -0
- data/server/node_modules/cradle/test/fixtures/databases.json +28 -1
- data/server/node_modules/cradle/test/helpers/seed.js +14 -5
- data/server/node_modules/cradle/test/response-test.js +1 -1
- data/server/node_modules/express/History.md +16 -0
- data/server/node_modules/express/bin/express +7 -6
- data/server/node_modules/express/lib-cov/application.js +510 -0
- data/server/node_modules/express/lib-cov/express.js +65 -0
- data/server/node_modules/express/lib-cov/middleware.js +54 -0
- data/server/node_modules/express/lib-cov/request.js +225 -0
- data/server/node_modules/express/lib-cov/response.js +611 -0
- data/server/node_modules/express/lib-cov/router/collection.js +40 -0
- data/server/node_modules/express/lib-cov/router/index.js +515 -0
- data/server/node_modules/express/lib-cov/router/methods.js +9 -0
- data/server/node_modules/express/lib-cov/router/route.js +68 -0
- data/server/node_modules/express/lib-cov/utils.js +151 -0
- data/server/node_modules/express/lib-cov/view.js +81 -0
- data/server/node_modules/express/lib/express.js +1 -1
- data/server/node_modules/express/lib/http.js +1 -2
- data/server/node_modules/express/lib/request.js +2 -2
- data/server/node_modules/express/lib/router/methods.js +10 -1
- data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
- data/server/node_modules/express/node_modules/connect/lib/http.js +3 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +0 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +1 -2
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +42 -25
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +1 -0
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +14 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
- data/server/node_modules/express/node_modules/connect/package.json +35 -7
- data/server/node_modules/express/node_modules/mime/package.json +30 -8
- data/server/node_modules/express/node_modules/mkdirp/README.markdown +35 -2
- data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +1 -1
- data/server/node_modules/express/node_modules/mkdirp/index.js +72 -13
- data/server/node_modules/express/node_modules/mkdirp/package.json +39 -21
- data/server/node_modules/express/node_modules/mkdirp/test/chmod.js +38 -0
- data/server/node_modules/express/node_modules/mkdirp/test/clobber.js +37 -0
- data/server/node_modules/express/node_modules/mkdirp/test/perm.js +32 -0
- data/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/server/node_modules/express/node_modules/mkdirp/test/sync.js +27 -0
- data/server/node_modules/express/node_modules/mkdirp/test/umask.js +28 -0
- data/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js +27 -0
- data/server/node_modules/express/node_modules/qs/History.md +10 -0
- data/server/node_modules/express/node_modules/qs/Readme.md +9 -2
- data/server/node_modules/express/node_modules/qs/examples.js +3 -0
- data/server/node_modules/express/node_modules/qs/lib/querystring.js +8 -6
- data/server/node_modules/express/node_modules/qs/package.json +26 -8
- data/server/node_modules/express/node_modules/qs/test/parse.js +13 -1
- data/server/node_modules/express/node_modules/qs/test/stringify.js +45 -37
- data/server/node_modules/express/package.json +55 -16
- data/server/node_modules/express/test.js +41 -0
- data/server/node_modules/knox/package.json +26 -4
- data/server/node_modules/node-uuid/package.json +40 -11
- data/server/node_modules/node-uuid/test/test.js +1 -1
- data/server/node_modules/nodemon/README.md +120 -0
- data/server/node_modules/nodemon/nodemon.js +518 -0
- data/server/node_modules/nodemon/nodemonignore.example +11 -0
- data/server/node_modules/nodemon/package.json +49 -0
- data/server/node_modules/restler/README.md +144 -94
- data/server/node_modules/restler/lib/multipartform.js +2 -0
- data/server/node_modules/restler/lib/restler.js +218 -61
- data/server/node_modules/restler/package.json +35 -8
- data/server/node_modules/restler/test/all.js +6 -1
- data/server/node_modules/restler/test/restler.js +624 -118
- data/server/package.json +14 -10
- data/server/web.coffee +64 -0
- data/server/web.js +15 -3
- metadata +170 -57
- data/server/index.js +0 -14
- data/server/node_modules/connect-form/LICENSE +0 -22
- data/server/node_modules/connect-form/index.js +0 -100
- data/server/node_modules/connect-form/node_modules/formidable/test/fast/test-incoming-form.js +0 -45
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/cradle/Makefile +0 -10
- data/server/node_modules/cradle/test/cradle-test.js +0 -650
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/express/node_modules/connect/test.js +0 -52
- data/server/node_modules/express/testing/foo/app.js +0 -35
- data/server/node_modules/express/testing/foo/package.json +0 -9
- data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
- data/server/node_modules/express/testing/foo/routes/index.js +0 -10
- data/server/node_modules/express/testing/foo/views/index.jade +0 -2
- data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
- data/server/node_modules/express/testing/index.js +0 -43
- data/server/node_modules/express/testing/public/test.txt +0 -2971
- data/server/node_modules/express/testing/views/page.html +0 -1
- data/server/node_modules/express/testing/views/page.jade +0 -3
- data/server/node_modules/express/testing/views/test.md +0 -1
- data/server/node_modules/express/testing/views/user/index.jade +0 -1
- data/server/node_modules/express/testing/views/user/list.jade +0 -1
- data/server/node_modules/knox/lib/knox/mime/index.js +0 -308
- data/server/node_modules/knox/lib/knox/mime/test.js +0 -59
- data/server/node_modules/node-uuid/test/benchmark-native +0 -0
- data/server/node_modules/on/index.js +0 -13
- data/server/node_modules/restler/test/test_helper.js +0 -163
- data/server/node_modules/spawner/index.js +0 -106
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* automatically generated by JSCoverage - do not edit */
|
|
2
|
+
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
|
3
|
+
if (! _$jscoverage['express.js']) {
|
|
4
|
+
_$jscoverage['express.js'] = [];
|
|
5
|
+
_$jscoverage['express.js'][12] = 0;
|
|
6
|
+
_$jscoverage['express.js'][25] = 0;
|
|
7
|
+
_$jscoverage['express.js'][31] = 0;
|
|
8
|
+
_$jscoverage['express.js'][40] = 0;
|
|
9
|
+
_$jscoverage['express.js'][41] = 0;
|
|
10
|
+
_$jscoverage['express.js'][42] = 0;
|
|
11
|
+
_$jscoverage['express.js'][43] = 0;
|
|
12
|
+
_$jscoverage['express.js'][44] = 0;
|
|
13
|
+
_$jscoverage['express.js'][45] = 0;
|
|
14
|
+
_$jscoverage['express.js'][46] = 0;
|
|
15
|
+
_$jscoverage['express.js'][54] = 0;
|
|
16
|
+
_$jscoverage['express.js'][55] = 0;
|
|
17
|
+
_$jscoverage['express.js'][65] = 0;
|
|
18
|
+
_$jscoverage['express.js'][66] = 0;
|
|
19
|
+
_$jscoverage['express.js'][67] = 0;
|
|
20
|
+
_$jscoverage['express.js'][73] = 0;
|
|
21
|
+
_$jscoverage['express.js'][74] = 0;
|
|
22
|
+
_$jscoverage['express.js'][80] = 0;
|
|
23
|
+
_$jscoverage['express.js'][84] = 0;
|
|
24
|
+
}
|
|
25
|
+
_$jscoverage['express.js'][12]++;
|
|
26
|
+
var http = require("http"), connect = require("connect"), proto = require("./application"), Route = require("./router/route"), Router = require("./router"), req = require("./request"), res = require("./response"), utils = connect.utils;
|
|
27
|
+
_$jscoverage['express.js'][25]++;
|
|
28
|
+
exports = module.exports = createApplication;
|
|
29
|
+
_$jscoverage['express.js'][31]++;
|
|
30
|
+
exports.version = "3.0.0alpha1-pre";
|
|
31
|
+
_$jscoverage['express.js'][40]++;
|
|
32
|
+
function createApplication() {
|
|
33
|
+
_$jscoverage['express.js'][41]++;
|
|
34
|
+
var app = connect();
|
|
35
|
+
_$jscoverage['express.js'][42]++;
|
|
36
|
+
utils.merge(app, proto);
|
|
37
|
+
_$jscoverage['express.js'][43]++;
|
|
38
|
+
app.request = {__proto__: req};
|
|
39
|
+
_$jscoverage['express.js'][44]++;
|
|
40
|
+
app.response = {__proto__: res};
|
|
41
|
+
_$jscoverage['express.js'][45]++;
|
|
42
|
+
app.init();
|
|
43
|
+
_$jscoverage['express.js'][46]++;
|
|
44
|
+
return app;
|
|
45
|
+
}
|
|
46
|
+
_$jscoverage['express.js'][54]++;
|
|
47
|
+
for (var key in connect.middleware) {
|
|
48
|
+
_$jscoverage['express.js'][55]++;
|
|
49
|
+
Object.defineProperty(exports, key, Object.getOwnPropertyDescriptor(connect.middleware, key));
|
|
50
|
+
}
|
|
51
|
+
_$jscoverage['express.js'][65]++;
|
|
52
|
+
exports.application = proto;
|
|
53
|
+
_$jscoverage['express.js'][66]++;
|
|
54
|
+
exports.request = req;
|
|
55
|
+
_$jscoverage['express.js'][67]++;
|
|
56
|
+
exports.response = res;
|
|
57
|
+
_$jscoverage['express.js'][73]++;
|
|
58
|
+
exports.Route = Route;
|
|
59
|
+
_$jscoverage['express.js'][74]++;
|
|
60
|
+
exports.Router = Router;
|
|
61
|
+
_$jscoverage['express.js'][80]++;
|
|
62
|
+
exports.methods = require("./router/methods");
|
|
63
|
+
_$jscoverage['express.js'][84]++;
|
|
64
|
+
exports.errorHandler.title = "Express";
|
|
65
|
+
_$jscoverage['express.js'].source = ["","/*!"," * Express"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , connect = require('connect')"," , proto = require('./application')"," , Route = require('./router/route')"," , Router = require('./router')"," , req = require('./request')"," , res = require('./response')"," , utils = connect.utils;","","/**"," * Expose `createApplication()`."," */","","exports = module.exports = createApplication;","","/**"," * Framework version."," */","","exports.version = '3.0.0alpha1-pre';","","/**"," * Create an express application."," *"," * @return {Function}"," * @api public"," */","","function createApplication() {"," var app = connect();"," utils.merge(app, proto);"," app.request = { __proto__: req };"," app.response = { __proto__: res };"," app.init();"," return app;","}","","/**"," * Expose connect.middleware as express.*"," * for example `express.logger` etc. "," */","","for (var key in connect.middleware) {"," Object.defineProperty("," exports"," , key"," , Object.getOwnPropertyDescriptor(connect.middleware, key));","}","","/**"," * Expose the prototypes."," */","","exports.application = proto;","exports.request = req;","exports.response = res;","","/**"," * Expose constructors."," */","","exports.Route = Route;","exports.Router = Router;","","/**"," * Expose HTTP methods."," */","","exports.methods = require('./router/methods');","","// Error handler title","","exports.errorHandler.title = 'Express';",""];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* automatically generated by JSCoverage - do not edit */
|
|
2
|
+
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
|
3
|
+
if (! _$jscoverage['middleware.js']) {
|
|
4
|
+
_$jscoverage['middleware.js'] = [];
|
|
5
|
+
_$jscoverage['middleware.js'][18] = 0;
|
|
6
|
+
_$jscoverage['middleware.js'][19] = 0;
|
|
7
|
+
_$jscoverage['middleware.js'][20] = 0;
|
|
8
|
+
_$jscoverage['middleware.js'][21] = 0;
|
|
9
|
+
_$jscoverage['middleware.js'][22] = 0;
|
|
10
|
+
_$jscoverage['middleware.js'][23] = 0;
|
|
11
|
+
_$jscoverage['middleware.js'][24] = 0;
|
|
12
|
+
_$jscoverage['middleware.js'][25] = 0;
|
|
13
|
+
_$jscoverage['middleware.js'][27] = 0;
|
|
14
|
+
_$jscoverage['middleware.js'][28] = 0;
|
|
15
|
+
_$jscoverage['middleware.js'][30] = 0;
|
|
16
|
+
_$jscoverage['middleware.js'][31] = 0;
|
|
17
|
+
_$jscoverage['middleware.js'][32] = 0;
|
|
18
|
+
_$jscoverage['middleware.js'][35] = 0;
|
|
19
|
+
}
|
|
20
|
+
_$jscoverage['middleware.js'][18]++;
|
|
21
|
+
exports.init = (function (app) {
|
|
22
|
+
_$jscoverage['middleware.js'][19]++;
|
|
23
|
+
return (function (req, res, next) {
|
|
24
|
+
_$jscoverage['middleware.js'][20]++;
|
|
25
|
+
var charset;
|
|
26
|
+
_$jscoverage['middleware.js'][21]++;
|
|
27
|
+
res.setHeader("X-Powered-By", "Express");
|
|
28
|
+
_$jscoverage['middleware.js'][22]++;
|
|
29
|
+
req.app = res.app = app;
|
|
30
|
+
_$jscoverage['middleware.js'][23]++;
|
|
31
|
+
req.res = res;
|
|
32
|
+
_$jscoverage['middleware.js'][24]++;
|
|
33
|
+
res.req = req;
|
|
34
|
+
_$jscoverage['middleware.js'][25]++;
|
|
35
|
+
req.next = next;
|
|
36
|
+
_$jscoverage['middleware.js'][27]++;
|
|
37
|
+
req.__proto__ = app.request;
|
|
38
|
+
_$jscoverage['middleware.js'][28]++;
|
|
39
|
+
res.__proto__ = app.response;
|
|
40
|
+
_$jscoverage['middleware.js'][30]++;
|
|
41
|
+
res.locals = (function (obj) {
|
|
42
|
+
_$jscoverage['middleware.js'][31]++;
|
|
43
|
+
for (var key in obj) {
|
|
44
|
+
_$jscoverage['middleware.js'][31]++;
|
|
45
|
+
res.locals[key] = obj[key];
|
|
46
|
+
}
|
|
47
|
+
_$jscoverage['middleware.js'][32]++;
|
|
48
|
+
return res;
|
|
49
|
+
});
|
|
50
|
+
_$jscoverage['middleware.js'][35]++;
|
|
51
|
+
next();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
_$jscoverage['middleware.js'].source = ["","/*!"," * Express - middleware - init"," * Copyright(c) 2010-2011 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Initialization middleware, exposing the"," * request and response to eachother, as well"," * as defaulting the X-Powered-By header field."," *"," * @param {Function} app"," * @return {Function}"," * @api private"," */","","exports.init = function(app){"," return function(req, res, next){"," var charset;"," res.setHeader('X-Powered-By', 'Express');"," req.app = res.app = app;"," req.res = res;"," res.req = req;"," req.next = next;",""," req.__proto__ = app.request;"," res.__proto__ = app.response;",""," res.locals = function(obj){"," for (var key in obj) res.locals[key] = obj[key];"," return res;"," };",""," next();"," }","};"];
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/* automatically generated by JSCoverage - do not edit */
|
|
2
|
+
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
|
3
|
+
if (! _$jscoverage['request.js']) {
|
|
4
|
+
_$jscoverage['request.js'] = [];
|
|
5
|
+
_$jscoverage['request.js'][12] = 0;
|
|
6
|
+
_$jscoverage['request.js'][22] = 0;
|
|
7
|
+
_$jscoverage['request.js'][49] = 0;
|
|
8
|
+
_$jscoverage['request.js'][50] = 0;
|
|
9
|
+
_$jscoverage['request.js'][53] = 0;
|
|
10
|
+
_$jscoverage['request.js'][56] = 0;
|
|
11
|
+
_$jscoverage['request.js'][86] = 0;
|
|
12
|
+
_$jscoverage['request.js'][87] = 0;
|
|
13
|
+
_$jscoverage['request.js'][99] = 0;
|
|
14
|
+
_$jscoverage['request.js'][100] = 0;
|
|
15
|
+
_$jscoverage['request.js'][101] = 0;
|
|
16
|
+
_$jscoverage['request.js'][115] = 0;
|
|
17
|
+
_$jscoverage['request.js'][116] = 0;
|
|
18
|
+
_$jscoverage['request.js'][117] = 0;
|
|
19
|
+
_$jscoverage['request.js'][141] = 0;
|
|
20
|
+
_$jscoverage['request.js'][142] = 0;
|
|
21
|
+
_$jscoverage['request.js'][143] = 0;
|
|
22
|
+
_$jscoverage['request.js'][161] = 0;
|
|
23
|
+
_$jscoverage['request.js'][162] = 0;
|
|
24
|
+
_$jscoverage['request.js'][163] = 0;
|
|
25
|
+
_$jscoverage['request.js'][167] = 0;
|
|
26
|
+
_$jscoverage['request.js'][185] = 0;
|
|
27
|
+
_$jscoverage['request.js'][186] = 0;
|
|
28
|
+
_$jscoverage['request.js'][187] = 0;
|
|
29
|
+
_$jscoverage['request.js'][191] = 0;
|
|
30
|
+
_$jscoverage['request.js'][213] = 0;
|
|
31
|
+
_$jscoverage['request.js'][215] = 0;
|
|
32
|
+
_$jscoverage['request.js'][218] = 0;
|
|
33
|
+
_$jscoverage['request.js'][221] = 0;
|
|
34
|
+
_$jscoverage['request.js'][225] = 0;
|
|
35
|
+
_$jscoverage['request.js'][227] = 0;
|
|
36
|
+
_$jscoverage['request.js'][267] = 0;
|
|
37
|
+
_$jscoverage['request.js'][268] = 0;
|
|
38
|
+
_$jscoverage['request.js'][269] = 0;
|
|
39
|
+
_$jscoverage['request.js'][270] = 0;
|
|
40
|
+
_$jscoverage['request.js'][271] = 0;
|
|
41
|
+
_$jscoverage['request.js'][272] = 0;
|
|
42
|
+
_$jscoverage['request.js'][273] = 0;
|
|
43
|
+
_$jscoverage['request.js'][274] = 0;
|
|
44
|
+
_$jscoverage['request.js'][275] = 0;
|
|
45
|
+
_$jscoverage['request.js'][276] = 0;
|
|
46
|
+
_$jscoverage['request.js'][277] = 0;
|
|
47
|
+
_$jscoverage['request.js'][279] = 0;
|
|
48
|
+
_$jscoverage['request.js'][294] = 0;
|
|
49
|
+
_$jscoverage['request.js'][295] = 0;
|
|
50
|
+
_$jscoverage['request.js'][296] = 0;
|
|
51
|
+
_$jscoverage['request.js'][310] = 0;
|
|
52
|
+
_$jscoverage['request.js'][311] = 0;
|
|
53
|
+
_$jscoverage['request.js'][324] = 0;
|
|
54
|
+
_$jscoverage['request.js'][325] = 0;
|
|
55
|
+
_$jscoverage['request.js'][338] = 0;
|
|
56
|
+
_$jscoverage['request.js'][339] = 0;
|
|
57
|
+
_$jscoverage['request.js'][351] = 0;
|
|
58
|
+
_$jscoverage['request.js'][352] = 0;
|
|
59
|
+
_$jscoverage['request.js'][364] = 0;
|
|
60
|
+
_$jscoverage['request.js'][365] = 0;
|
|
61
|
+
_$jscoverage['request.js'][375] = 0;
|
|
62
|
+
_$jscoverage['request.js'][376] = 0;
|
|
63
|
+
_$jscoverage['request.js'][377] = 0;
|
|
64
|
+
}
|
|
65
|
+
_$jscoverage['request.js'][12]++;
|
|
66
|
+
var http = require("http"), utils = require("./utils"), connect = require("connect"), parse = require("url").parse, mime = require("mime");
|
|
67
|
+
_$jscoverage['request.js'][22]++;
|
|
68
|
+
var req = exports = module.exports = {__proto__: http.IncomingMessage.prototype};
|
|
69
|
+
_$jscoverage['request.js'][49]++;
|
|
70
|
+
req.get = (function (name) {
|
|
71
|
+
_$jscoverage['request.js'][50]++;
|
|
72
|
+
switch (name = name.toLowerCase()) {
|
|
73
|
+
case "referer":
|
|
74
|
+
case "referrer":
|
|
75
|
+
_$jscoverage['request.js'][53]++;
|
|
76
|
+
return this.headers.referrer || this.headers.referer;
|
|
77
|
+
default:
|
|
78
|
+
_$jscoverage['request.js'][56]++;
|
|
79
|
+
return this.headers[name];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
_$jscoverage['request.js'][86]++;
|
|
83
|
+
req.accepts = (function (type) {
|
|
84
|
+
_$jscoverage['request.js'][87]++;
|
|
85
|
+
return utils.accepts(type, this.get("Accept"));
|
|
86
|
+
});
|
|
87
|
+
_$jscoverage['request.js'][99]++;
|
|
88
|
+
req.acceptsCharset = (function (charset) {
|
|
89
|
+
_$jscoverage['request.js'][100]++;
|
|
90
|
+
var accepted = this.acceptedCharsets;
|
|
91
|
+
_$jscoverage['request.js'][101]++;
|
|
92
|
+
return accepted.length? ~ accepted.indexOf(charset): true;
|
|
93
|
+
});
|
|
94
|
+
_$jscoverage['request.js'][115]++;
|
|
95
|
+
req.acceptsLanguage = (function (lang) {
|
|
96
|
+
_$jscoverage['request.js'][116]++;
|
|
97
|
+
var accepted = this.acceptedLanguages;
|
|
98
|
+
_$jscoverage['request.js'][117]++;
|
|
99
|
+
return accepted.length? ~ accepted.indexOf(lang): true;
|
|
100
|
+
});
|
|
101
|
+
_$jscoverage['request.js'][141]++;
|
|
102
|
+
req.__defineGetter__("accepted", (function () {
|
|
103
|
+
_$jscoverage['request.js'][142]++;
|
|
104
|
+
var accept = this.get("Accept");
|
|
105
|
+
_$jscoverage['request.js'][143]++;
|
|
106
|
+
return accept? utils.parseAccept(accept): [];
|
|
107
|
+
}));
|
|
108
|
+
_$jscoverage['request.js'][161]++;
|
|
109
|
+
req.__defineGetter__("acceptedLanguages", (function () {
|
|
110
|
+
_$jscoverage['request.js'][162]++;
|
|
111
|
+
var accept = this.get("Accept-Language");
|
|
112
|
+
_$jscoverage['request.js'][163]++;
|
|
113
|
+
return accept? utils.parseQuality(accept).map((function (obj) {
|
|
114
|
+
_$jscoverage['request.js'][167]++;
|
|
115
|
+
return obj.value;
|
|
116
|
+
})): [];
|
|
117
|
+
}));
|
|
118
|
+
_$jscoverage['request.js'][185]++;
|
|
119
|
+
req.__defineGetter__("acceptedCharsets", (function () {
|
|
120
|
+
_$jscoverage['request.js'][186]++;
|
|
121
|
+
var accept = this.get("Accept-Charset");
|
|
122
|
+
_$jscoverage['request.js'][187]++;
|
|
123
|
+
return accept? utils.parseQuality(accept).map((function (obj) {
|
|
124
|
+
_$jscoverage['request.js'][191]++;
|
|
125
|
+
return obj.value;
|
|
126
|
+
})): [];
|
|
127
|
+
}));
|
|
128
|
+
_$jscoverage['request.js'][213]++;
|
|
129
|
+
req.param = (function (name, defaultValue) {
|
|
130
|
+
_$jscoverage['request.js'][215]++;
|
|
131
|
+
if (this.body && undefined !== this.body[name]) {
|
|
132
|
+
_$jscoverage['request.js'][215]++;
|
|
133
|
+
return this.body[name];
|
|
134
|
+
}
|
|
135
|
+
_$jscoverage['request.js'][218]++;
|
|
136
|
+
if (this.params && this.params.hasOwnProperty(name) && undefined !== this.params[name]) {
|
|
137
|
+
_$jscoverage['request.js'][221]++;
|
|
138
|
+
return this.params[name];
|
|
139
|
+
}
|
|
140
|
+
_$jscoverage['request.js'][225]++;
|
|
141
|
+
if (undefined !== this.query[name]) {
|
|
142
|
+
_$jscoverage['request.js'][225]++;
|
|
143
|
+
return this.query[name];
|
|
144
|
+
}
|
|
145
|
+
_$jscoverage['request.js'][227]++;
|
|
146
|
+
return defaultValue;
|
|
147
|
+
});
|
|
148
|
+
_$jscoverage['request.js'][267]++;
|
|
149
|
+
req.is = (function (type) {
|
|
150
|
+
_$jscoverage['request.js'][268]++;
|
|
151
|
+
var ct = this.get("Content-Type");
|
|
152
|
+
_$jscoverage['request.js'][269]++;
|
|
153
|
+
if (! ct) {
|
|
154
|
+
_$jscoverage['request.js'][269]++;
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
_$jscoverage['request.js'][270]++;
|
|
158
|
+
ct = ct.split(";")[0];
|
|
159
|
+
_$jscoverage['request.js'][271]++;
|
|
160
|
+
if (! ~ type.indexOf("/")) {
|
|
161
|
+
_$jscoverage['request.js'][271]++;
|
|
162
|
+
type = mime.lookup(type);
|
|
163
|
+
}
|
|
164
|
+
_$jscoverage['request.js'][272]++;
|
|
165
|
+
if (~ type.indexOf("*")) {
|
|
166
|
+
_$jscoverage['request.js'][273]++;
|
|
167
|
+
type = type.split("/");
|
|
168
|
+
_$jscoverage['request.js'][274]++;
|
|
169
|
+
ct = ct.split("/");
|
|
170
|
+
_$jscoverage['request.js'][275]++;
|
|
171
|
+
if ("*" == type[0] && type[1] == ct[1]) {
|
|
172
|
+
_$jscoverage['request.js'][275]++;
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
_$jscoverage['request.js'][276]++;
|
|
176
|
+
if ("*" == type[1] && type[0] == ct[0]) {
|
|
177
|
+
_$jscoverage['request.js'][276]++;
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
_$jscoverage['request.js'][277]++;
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
_$jscoverage['request.js'][279]++;
|
|
184
|
+
return ! ! ~ ct.indexOf(type);
|
|
185
|
+
});
|
|
186
|
+
_$jscoverage['request.js'][294]++;
|
|
187
|
+
req.__defineGetter__("protocol", (function (trustProxy) {
|
|
188
|
+
_$jscoverage['request.js'][295]++;
|
|
189
|
+
var trustProxy = this.app.settings["trust proxy"];
|
|
190
|
+
_$jscoverage['request.js'][296]++;
|
|
191
|
+
return this.secure? "https": trustProxy? (this.get("X-Forwarded-Proto") || "http"): "http";
|
|
192
|
+
}));
|
|
193
|
+
_$jscoverage['request.js'][310]++;
|
|
194
|
+
req.__defineGetter__("secure", (function () {
|
|
195
|
+
_$jscoverage['request.js'][311]++;
|
|
196
|
+
return this.connection.encrypted;
|
|
197
|
+
}));
|
|
198
|
+
_$jscoverage['request.js'][324]++;
|
|
199
|
+
req.__defineGetter__("subdomains", (function () {
|
|
200
|
+
_$jscoverage['request.js'][325]++;
|
|
201
|
+
return this.get("Host").split(".").slice(0, -2).reverse();
|
|
202
|
+
}));
|
|
203
|
+
_$jscoverage['request.js'][338]++;
|
|
204
|
+
req.__defineGetter__("path", (function () {
|
|
205
|
+
_$jscoverage['request.js'][339]++;
|
|
206
|
+
return parse(this.url).pathname;
|
|
207
|
+
}));
|
|
208
|
+
_$jscoverage['request.js'][351]++;
|
|
209
|
+
req.__defineGetter__("fresh", (function () {
|
|
210
|
+
_$jscoverage['request.js'][352]++;
|
|
211
|
+
return ! this.stale;
|
|
212
|
+
}));
|
|
213
|
+
_$jscoverage['request.js'][364]++;
|
|
214
|
+
req.__defineGetter__("stale", (function () {
|
|
215
|
+
_$jscoverage['request.js'][365]++;
|
|
216
|
+
return connect.utils.modified(this, this.res);
|
|
217
|
+
}));
|
|
218
|
+
_$jscoverage['request.js'][375]++;
|
|
219
|
+
req.__defineGetter__("xhr", (function () {
|
|
220
|
+
_$jscoverage['request.js'][376]++;
|
|
221
|
+
var val = this.get("X-Requested-With") || "";
|
|
222
|
+
_$jscoverage['request.js'][377]++;
|
|
223
|
+
return "xmlhttprequest" == val.toLowerCase();
|
|
224
|
+
}));
|
|
225
|
+
_$jscoverage['request.js'].source = ["","/*!"," * Express - request"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var http = require('http')"," , utils = require('./utils')"," , connect = require('connect')"," , parse = require('url').parse"," , mime = require('mime');","","/**"," * Request prototype."," */","","var req = exports = module.exports = {"," __proto__: http.IncomingMessage.prototype","};","","/**"," * Return request header."," *"," * The `Referrer` header field is special-cased,"," * both `Referrer` and `Referer` will yield are"," * interchangeable."," *"," * Examples:"," *"," * req.get('Content-Type');"," * // => \"text/plain\""," * "," * req.get('content-type');"," * // => \"text/plain\""," * "," * req.get('Something');"," * // => undefined"," * "," * @param {String} name"," * @return {String} "," * @api public"," */","","req.get = function(name){"," switch (name = name.toLowerCase()) {"," case 'referer':"," case 'referrer':"," return this.headers.referrer"," || this.headers.referer;"," default:"," return this.headers[name];"," }","};","","/**"," * Check if the given `type` is acceptable,"," * otherwise you should respond with 406 \"Not Acceptable\"."," *"," * Examples:"," * "," * // Accept: text/html"," * req.accepts('html');"," * // => true"," *"," * // Accept: text/*; application/json"," * req.accepts('html');"," * req.accepts('text/html');"," * req.accepts('text/plain');"," * req.accepts('application/json');"," * // => true"," *"," * req.accepts('image/png');"," * req.accepts('png');"," * // => false"," *"," * @param {String} type"," * @return {Boolean}"," * @api public"," */","","req.accepts = function(type){"," return utils.accepts(type, this.get('Accept'));","};","","/**"," * Check if the given `charset` is acceptable,"," * otherwise you should respond with 406 \"Not Acceptable\"."," *"," * @param {String} charset"," * @return {Boolean}"," * @api public"," */","","req.acceptsCharset = function(charset){"," var accepted = this.acceptedCharsets;"," return accepted.length"," ? ~accepted.indexOf(charset)"," : true;","};","","/**"," * Check if the given `lang` is acceptable,"," * otherwise you should respond with 406 \"Not Acceptable\"."," *"," * @param {String} lang"," * @return {Boolean}"," * @api public"," */","","req.acceptsLanguage = function(lang){"," var accepted = this.acceptedLanguages;"," return accepted.length"," ? ~accepted.indexOf(lang)"," : true;","};","","/**"," * Return an array of Accepted media types"," * ordered from highest quality to lowest."," *"," * Examples:"," *"," * [ { value: 'application/json',"," * quality: 1,"," * type: 'application',"," * subtype: 'json' },"," * { value: 'text/html',"," * quality: 0.5,"," * type: 'text',"," * subtype: 'html' } ]"," *"," * @return {Array}"," * @api public"," */","","req.__defineGetter__('accepted', function(){"," var accept = this.get('Accept');"," return accept"," ? utils.parseAccept(accept)"," : [];","});","","/**"," * Return an array of Accepted languages"," * ordered from highest quality to lowest."," *"," * Examples:"," *"," * Accept-Language: en;q=.5, en-us"," * ['en-us', 'en']"," *"," * @return {Array}"," * @api public"," */","","req.__defineGetter__('acceptedLanguages', function(){"," var accept = this.get('Accept-Language');"," return accept"," ? utils"," .parseQuality(accept)"," .map(function(obj){"," return obj.value;"," })"," : [];","});","","/**"," * Return an array of Accepted charsets"," * ordered from highest quality to lowest."," *"," * Examples:"," *"," * Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8"," * ['unicode-1-1', 'iso-8859-5']"," *"," * @return {Array}"," * @api public"," */","","req.__defineGetter__('acceptedCharsets', function(){"," var accept = this.get('Accept-Charset');"," return accept"," ? utils"," .parseQuality(accept)"," .map(function(obj){"," return obj.value;"," })"," : [];","});","","/**"," * Return the value of param `name` when present or `defaultValue`."," *"," * - Checks body params, ex: id=12, {\"id\":12}"," * - Checks route placeholders, ex: _/user/:id_"," * - Checks query string params, ex: ?id=12"," *"," * To utilize request bodies, `req.body`"," * should be an object. This can be done by using"," * the `connect.bodyParser()` middleware."," *"," * @param {String} name"," * @param {Mixed} defaultValue"," * @return {String}"," * @api public"," */","","req.param = function(name, defaultValue){"," // req.body"," if (this.body && undefined !== this.body[name]) return this.body[name];",""," // route params"," if (this.params"," && this.params.hasOwnProperty(name)"," && undefined !== this.params[name]) {"," return this.params[name]; "," }",""," // query-string"," if (undefined !== this.query[name]) return this.query[name]; ",""," return defaultValue;","};","","/**"," * Check if the incoming request contains the \"Content-Type\" "," * header field, and it contains the give mime `type`."," *"," * Examples:"," *"," * // With Content-Type: text/html; charset=utf-8"," * req.is('html');"," * req.is('text/html');"," * req.is('text/*');"," * // => true"," * "," * // When Content-Type is application/json"," * req.is('json');"," * req.is('application/json');"," * req.is('application/*');"," * // => true"," * "," * req.is('html');"," * // => false"," * "," * Now within our route callbacks, we can use to to assert content types"," * such as \"image/jpeg\", \"image/png\", etc."," * "," * app.post('/image/upload', function(req, res, next){"," * if (req.is('image/*')) {"," * // do something"," * } else {"," * next();"," * }"," * });"," * "," * @param {String} type"," * @return {Boolean}"," * @api public"," */","","req.is = function(type){"," var ct = this.get('Content-Type');"," if (!ct) return false;"," ct = ct.split(';')[0];"," if (!~type.indexOf('/')) type = mime.lookup(type);"," if (~type.indexOf('*')) {"," type = type.split('/');"," ct = ct.split('/');"," if ('*' == type[0] && type[1] == ct[1]) return true;"," if ('*' == type[1] && type[0] == ct[0]) return true;"," return false;"," }"," return !! ~ct.indexOf(type);","};","","/**"," * Return the protocol string \"http\" or \"https\""," * when requested with TLS. When the \"trust proxy\" "," * setting is enabled the \"X-Forwarded-Proto\" header"," * field will be trusted. If you're running behind"," * a reverse proxy that supplies https for you this"," * may be enabled."," *"," * @return {String}"," * @api public"," */","","req.__defineGetter__('protocol', function(trustProxy){"," var trustProxy = this.app.settings['trust proxy'];"," return this.secure"," ? 'https'"," : trustProxy"," ? (this.get('X-Forwarded-Proto') || 'http')"," : 'http';","});","","/**"," * Short-hand for `req.connection.encrypted`."," *"," * @return {Boolean}"," * @api public"," */","","req.__defineGetter__('secure', function(){"," return this.connection.encrypted;","});","","/**"," * Return subdomains as an array."," *"," * For example \"tobi.ferrets.example.com\""," * would provide `[\"ferrets\", \"tobi\"]`."," *"," * @return {Array}"," * @api public"," */","","req.__defineGetter__('subdomains', function(){"," return this.get('Host')"," .split('.')"," .slice(0, -2)"," .reverse();","});","","/**"," * Short-hand for `require('url').parse(req.url).pathname`."," *"," * @return {String}"," * @api public"," */","","req.__defineGetter__('path', function(){"," return parse(this.url).pathname;","});","","/**"," * Check if the request is fresh, aka"," * Last-Modified and/or the ETag"," * still match."," *"," * @return {Boolean}"," * @api public"," */","","req.__defineGetter__('fresh', function(){"," return ! this.stale;","});","","/**"," * Check if the request is stale, aka"," * \"Last-Modified\" and / or the \"ETag\" for the"," * resource has changed."," *"," * @return {Boolean}"," * @api public"," */","","req.__defineGetter__('stale', function(){"," return connect.utils.modified(this, this.res);","});","","/**"," * Check if the request was an _XMLHttpRequest_."," *"," * @return {Boolean}"," * @api public"," */","","req.__defineGetter__('xhr', function(){"," var val = this.get('X-Requested-With') || '';"," return 'xmlhttprequest' == val.toLowerCase();","});"];
|
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
/* automatically generated by JSCoverage - do not edit */
|
|
2
|
+
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
|
3
|
+
if (! _$jscoverage['response.js']) {
|
|
4
|
+
_$jscoverage['response.js'] = [];
|
|
5
|
+
_$jscoverage['response.js'][12] = 0;
|
|
6
|
+
_$jscoverage['response.js'][28] = 0;
|
|
7
|
+
_$jscoverage['response.js'][40] = 0;
|
|
8
|
+
_$jscoverage['response.js'][41] = 0;
|
|
9
|
+
_$jscoverage['response.js'][42] = 0;
|
|
10
|
+
_$jscoverage['response.js'][58] = 0;
|
|
11
|
+
_$jscoverage['response.js'][59] = 0;
|
|
12
|
+
_$jscoverage['response.js'][60] = 0;
|
|
13
|
+
_$jscoverage['response.js'][61] = 0;
|
|
14
|
+
_$jscoverage['response.js'][62] = 0;
|
|
15
|
+
_$jscoverage['response.js'][82] = 0;
|
|
16
|
+
_$jscoverage['response.js'][83] = 0;
|
|
17
|
+
_$jscoverage['response.js'][87] = 0;
|
|
18
|
+
_$jscoverage['response.js'][88] = 0;
|
|
19
|
+
_$jscoverage['response.js'][89] = 0;
|
|
20
|
+
_$jscoverage['response.js'][92] = 0;
|
|
21
|
+
_$jscoverage['response.js'][95] = 0;
|
|
22
|
+
_$jscoverage['response.js'][96] = 0;
|
|
23
|
+
_$jscoverage['response.js'][97] = 0;
|
|
24
|
+
_$jscoverage['response.js'][98] = 0;
|
|
25
|
+
_$jscoverage['response.js'][101] = 0;
|
|
26
|
+
_$jscoverage['response.js'][102] = 0;
|
|
27
|
+
_$jscoverage['response.js'][103] = 0;
|
|
28
|
+
_$jscoverage['response.js'][105] = 0;
|
|
29
|
+
_$jscoverage['response.js'][108] = 0;
|
|
30
|
+
_$jscoverage['response.js'][109] = 0;
|
|
31
|
+
_$jscoverage['response.js'][110] = 0;
|
|
32
|
+
_$jscoverage['response.js'][111] = 0;
|
|
33
|
+
_$jscoverage['response.js'][113] = 0;
|
|
34
|
+
_$jscoverage['response.js'][115] = 0;
|
|
35
|
+
_$jscoverage['response.js'][119] = 0;
|
|
36
|
+
_$jscoverage['response.js'][120] = 0;
|
|
37
|
+
_$jscoverage['response.js'][126] = 0;
|
|
38
|
+
_$jscoverage['response.js'][127] = 0;
|
|
39
|
+
_$jscoverage['response.js'][128] = 0;
|
|
40
|
+
_$jscoverage['response.js'][129] = 0;
|
|
41
|
+
_$jscoverage['response.js'][133] = 0;
|
|
42
|
+
_$jscoverage['response.js'][134] = 0;
|
|
43
|
+
_$jscoverage['response.js'][153] = 0;
|
|
44
|
+
_$jscoverage['response.js'][155] = 0;
|
|
45
|
+
_$jscoverage['response.js'][156] = 0;
|
|
46
|
+
_$jscoverage['response.js'][157] = 0;
|
|
47
|
+
_$jscoverage['response.js'][160] = 0;
|
|
48
|
+
_$jscoverage['response.js'][167] = 0;
|
|
49
|
+
_$jscoverage['response.js'][168] = 0;
|
|
50
|
+
_$jscoverage['response.js'][170] = 0;
|
|
51
|
+
_$jscoverage['response.js'][171] = 0;
|
|
52
|
+
_$jscoverage['response.js'][172] = 0;
|
|
53
|
+
_$jscoverage['response.js'][175] = 0;
|
|
54
|
+
_$jscoverage['response.js'][198] = 0;
|
|
55
|
+
_$jscoverage['response.js'][199] = 0;
|
|
56
|
+
_$jscoverage['response.js'][205] = 0;
|
|
57
|
+
_$jscoverage['response.js'][206] = 0;
|
|
58
|
+
_$jscoverage['response.js'][207] = 0;
|
|
59
|
+
_$jscoverage['response.js'][211] = 0;
|
|
60
|
+
_$jscoverage['response.js'][212] = 0;
|
|
61
|
+
_$jscoverage['response.js'][214] = 0;
|
|
62
|
+
_$jscoverage['response.js'][219] = 0;
|
|
63
|
+
_$jscoverage['response.js'][222] = 0;
|
|
64
|
+
_$jscoverage['response.js'][225] = 0;
|
|
65
|
+
_$jscoverage['response.js'][228] = 0;
|
|
66
|
+
_$jscoverage['response.js'][230] = 0;
|
|
67
|
+
_$jscoverage['response.js'][233] = 0;
|
|
68
|
+
_$jscoverage['response.js'][237] = 0;
|
|
69
|
+
_$jscoverage['response.js'][238] = 0;
|
|
70
|
+
_$jscoverage['response.js'][255] = 0;
|
|
71
|
+
_$jscoverage['response.js'][257] = 0;
|
|
72
|
+
_$jscoverage['response.js'][258] = 0;
|
|
73
|
+
_$jscoverage['response.js'][259] = 0;
|
|
74
|
+
_$jscoverage['response.js'][262] = 0;
|
|
75
|
+
_$jscoverage['response.js'][285] = 0;
|
|
76
|
+
_$jscoverage['response.js'][287] = 0;
|
|
77
|
+
_$jscoverage['response.js'][341] = 0;
|
|
78
|
+
_$jscoverage['response.js'][342] = 0;
|
|
79
|
+
_$jscoverage['response.js'][352] = 0;
|
|
80
|
+
_$jscoverage['response.js'][353] = 0;
|
|
81
|
+
_$jscoverage['response.js'][354] = 0;
|
|
82
|
+
_$jscoverage['response.js'][361] = 0;
|
|
83
|
+
_$jscoverage['response.js'][363] = 0;
|
|
84
|
+
_$jscoverage['response.js'][364] = 0;
|
|
85
|
+
_$jscoverage['response.js'][365] = 0;
|
|
86
|
+
_$jscoverage['response.js'][366] = 0;
|
|
87
|
+
_$jscoverage['response.js'][367] = 0;
|
|
88
|
+
_$jscoverage['response.js'][373] = 0;
|
|
89
|
+
_$jscoverage['response.js'][374] = 0;
|
|
90
|
+
_$jscoverage['response.js'][375] = 0;
|
|
91
|
+
_$jscoverage['response.js'][378] = 0;
|
|
92
|
+
_$jscoverage['response.js'][379] = 0;
|
|
93
|
+
_$jscoverage['response.js'][380] = 0;
|
|
94
|
+
_$jscoverage['response.js'][382] = 0;
|
|
95
|
+
_$jscoverage['response.js'][383] = 0;
|
|
96
|
+
_$jscoverage['response.js'][384] = 0;
|
|
97
|
+
_$jscoverage['response.js'][385] = 0;
|
|
98
|
+
_$jscoverage['response.js'][388] = 0;
|
|
99
|
+
_$jscoverage['response.js'][399] = 0;
|
|
100
|
+
_$jscoverage['response.js'][400] = 0;
|
|
101
|
+
_$jscoverage['response.js'][401] = 0;
|
|
102
|
+
_$jscoverage['response.js'][404] = 0;
|
|
103
|
+
_$jscoverage['response.js'][422] = 0;
|
|
104
|
+
_$jscoverage['response.js'][423] = 0;
|
|
105
|
+
_$jscoverage['response.js'][424] = 0;
|
|
106
|
+
_$jscoverage['response.js'][426] = 0;
|
|
107
|
+
_$jscoverage['response.js'][427] = 0;
|
|
108
|
+
_$jscoverage['response.js'][430] = 0;
|
|
109
|
+
_$jscoverage['response.js'][441] = 0;
|
|
110
|
+
_$jscoverage['response.js'][442] = 0;
|
|
111
|
+
_$jscoverage['response.js'][454] = 0;
|
|
112
|
+
_$jscoverage['response.js'][455] = 0;
|
|
113
|
+
_$jscoverage['response.js'][456] = 0;
|
|
114
|
+
_$jscoverage['response.js'][471] = 0;
|
|
115
|
+
_$jscoverage['response.js'][472] = 0;
|
|
116
|
+
_$jscoverage['response.js'][473] = 0;
|
|
117
|
+
_$jscoverage['response.js'][474] = 0;
|
|
118
|
+
_$jscoverage['response.js'][475] = 0;
|
|
119
|
+
_$jscoverage['response.js'][476] = 0;
|
|
120
|
+
_$jscoverage['response.js'][501] = 0;
|
|
121
|
+
_$jscoverage['response.js'][502] = 0;
|
|
122
|
+
_$jscoverage['response.js'][503] = 0;
|
|
123
|
+
_$jscoverage['response.js'][504] = 0;
|
|
124
|
+
_$jscoverage['response.js'][505] = 0;
|
|
125
|
+
_$jscoverage['response.js'][506] = 0;
|
|
126
|
+
_$jscoverage['response.js'][507] = 0;
|
|
127
|
+
_$jscoverage['response.js'][508] = 0;
|
|
128
|
+
_$jscoverage['response.js'][543] = 0;
|
|
129
|
+
_$jscoverage['response.js'][544] = 0;
|
|
130
|
+
_$jscoverage['response.js'][551] = 0;
|
|
131
|
+
_$jscoverage['response.js'][552] = 0;
|
|
132
|
+
_$jscoverage['response.js'][553] = 0;
|
|
133
|
+
_$jscoverage['response.js'][557] = 0;
|
|
134
|
+
_$jscoverage['response.js'][560] = 0;
|
|
135
|
+
_$jscoverage['response.js'][563] = 0;
|
|
136
|
+
_$jscoverage['response.js'][564] = 0;
|
|
137
|
+
_$jscoverage['response.js'][567] = 0;
|
|
138
|
+
_$jscoverage['response.js'][568] = 0;
|
|
139
|
+
_$jscoverage['response.js'][570] = 0;
|
|
140
|
+
_$jscoverage['response.js'][571] = 0;
|
|
141
|
+
_$jscoverage['response.js'][575] = 0;
|
|
142
|
+
_$jscoverage['response.js'][576] = 0;
|
|
143
|
+
_$jscoverage['response.js'][580] = 0;
|
|
144
|
+
_$jscoverage['response.js'][582] = 0;
|
|
145
|
+
_$jscoverage['response.js'][586] = 0;
|
|
146
|
+
_$jscoverage['response.js'][591] = 0;
|
|
147
|
+
_$jscoverage['response.js'][592] = 0;
|
|
148
|
+
_$jscoverage['response.js'][593] = 0;
|
|
149
|
+
_$jscoverage['response.js'][617] = 0;
|
|
150
|
+
_$jscoverage['response.js'][618] = 0;
|
|
151
|
+
_$jscoverage['response.js'][624] = 0;
|
|
152
|
+
_$jscoverage['response.js'][625] = 0;
|
|
153
|
+
_$jscoverage['response.js'][628] = 0;
|
|
154
|
+
_$jscoverage['response.js'][630] = 0;
|
|
155
|
+
_$jscoverage['response.js'][633] = 0;
|
|
156
|
+
_$jscoverage['response.js'][634] = 0;
|
|
157
|
+
_$jscoverage['response.js'][635] = 0;
|
|
158
|
+
_$jscoverage['response.js'][639] = 0;
|
|
159
|
+
_$jscoverage['response.js'][643] = 0;
|
|
160
|
+
_$jscoverage['response.js'][648] = 0;
|
|
161
|
+
_$jscoverage['response.js'][649] = 0;
|
|
162
|
+
_$jscoverage['response.js'][650] = 0;
|
|
163
|
+
_$jscoverage['response.js'][651] = 0;
|
|
164
|
+
_$jscoverage['response.js'][653] = 0;
|
|
165
|
+
_$jscoverage['response.js'][654] = 0;
|
|
166
|
+
_$jscoverage['response.js'][655] = 0;
|
|
167
|
+
_$jscoverage['response.js'][656] = 0;
|
|
168
|
+
_$jscoverage['response.js'][659] = 0;
|
|
169
|
+
_$jscoverage['response.js'][663] = 0;
|
|
170
|
+
}
|
|
171
|
+
_$jscoverage['response.js'][12]++;
|
|
172
|
+
var fs = require("fs"), http = require("http"), path = require("path"), connect = require("connect"), utils = connect.utils, accept = require("./utils").accept, statusCodes = http.STATUS_CODES, send = connect["static"].send, mime = require("mime"), basename = path.basename, join = path.join;
|
|
173
|
+
_$jscoverage['response.js'][28]++;
|
|
174
|
+
var res = module.exports = {__proto__: http.ServerResponse.prototype};
|
|
175
|
+
_$jscoverage['response.js'][40]++;
|
|
176
|
+
res.status = (function (code) {
|
|
177
|
+
_$jscoverage['response.js'][41]++;
|
|
178
|
+
this.statusCode = code;
|
|
179
|
+
_$jscoverage['response.js'][42]++;
|
|
180
|
+
return this;
|
|
181
|
+
});
|
|
182
|
+
_$jscoverage['response.js'][58]++;
|
|
183
|
+
res.cache = (function (type, options) {
|
|
184
|
+
_$jscoverage['response.js'][59]++;
|
|
185
|
+
var val = type;
|
|
186
|
+
_$jscoverage['response.js'][60]++;
|
|
187
|
+
options = options || {};
|
|
188
|
+
_$jscoverage['response.js'][61]++;
|
|
189
|
+
if (options.maxAge) {
|
|
190
|
+
_$jscoverage['response.js'][61]++;
|
|
191
|
+
val += ", max-age=" + (options.maxAge / 1000);
|
|
192
|
+
}
|
|
193
|
+
_$jscoverage['response.js'][62]++;
|
|
194
|
+
return this.set("Cache-Control", val);
|
|
195
|
+
});
|
|
196
|
+
_$jscoverage['response.js'][82]++;
|
|
197
|
+
res.send = (function (body) {
|
|
198
|
+
_$jscoverage['response.js'][83]++;
|
|
199
|
+
var req = this.req, head = "HEAD" == req.method;
|
|
200
|
+
_$jscoverage['response.js'][87]++;
|
|
201
|
+
if (2 == arguments.length) {
|
|
202
|
+
_$jscoverage['response.js'][88]++;
|
|
203
|
+
this.statusCode = body;
|
|
204
|
+
_$jscoverage['response.js'][89]++;
|
|
205
|
+
body = arguments[1];
|
|
206
|
+
}
|
|
207
|
+
_$jscoverage['response.js'][92]++;
|
|
208
|
+
switch (typeof body) {
|
|
209
|
+
case "number":
|
|
210
|
+
_$jscoverage['response.js'][95]++;
|
|
211
|
+
this.get("Content-Type") || this.contentType(".txt");
|
|
212
|
+
_$jscoverage['response.js'][96]++;
|
|
213
|
+
this.statusCode = body;
|
|
214
|
+
_$jscoverage['response.js'][97]++;
|
|
215
|
+
body = http.STATUS_CODES[body];
|
|
216
|
+
_$jscoverage['response.js'][98]++;
|
|
217
|
+
break;
|
|
218
|
+
case "string":
|
|
219
|
+
_$jscoverage['response.js'][101]++;
|
|
220
|
+
if (! this.get("Content-Type")) {
|
|
221
|
+
_$jscoverage['response.js'][102]++;
|
|
222
|
+
this.charset = this.charset || "utf-8";
|
|
223
|
+
_$jscoverage['response.js'][103]++;
|
|
224
|
+
this.contentType(".html");
|
|
225
|
+
}
|
|
226
|
+
_$jscoverage['response.js'][105]++;
|
|
227
|
+
break;
|
|
228
|
+
case "boolean":
|
|
229
|
+
case "object":
|
|
230
|
+
_$jscoverage['response.js'][108]++;
|
|
231
|
+
if (null == body) {
|
|
232
|
+
_$jscoverage['response.js'][109]++;
|
|
233
|
+
body = "";
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
_$jscoverage['response.js'][110]++;
|
|
237
|
+
if (Buffer.isBuffer(body)) {
|
|
238
|
+
_$jscoverage['response.js'][111]++;
|
|
239
|
+
this.get("Content-Type") || this.contentType(".bin");
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
_$jscoverage['response.js'][113]++;
|
|
243
|
+
return this.json(body);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
_$jscoverage['response.js'][115]++;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
_$jscoverage['response.js'][119]++;
|
|
250
|
+
if (undefined !== body && ! this.get("Content-Length")) {
|
|
251
|
+
_$jscoverage['response.js'][120]++;
|
|
252
|
+
this.set("Content-Length", Buffer.isBuffer(body)? body.length: Buffer.byteLength(body));
|
|
253
|
+
}
|
|
254
|
+
_$jscoverage['response.js'][126]++;
|
|
255
|
+
if (204 == this.statusCode || 304 == this.statusCode) {
|
|
256
|
+
_$jscoverage['response.js'][127]++;
|
|
257
|
+
this.removeHeader("Content-Type");
|
|
258
|
+
_$jscoverage['response.js'][128]++;
|
|
259
|
+
this.removeHeader("Content-Length");
|
|
260
|
+
_$jscoverage['response.js'][129]++;
|
|
261
|
+
body = "";
|
|
262
|
+
}
|
|
263
|
+
_$jscoverage['response.js'][133]++;
|
|
264
|
+
this.end(head? null: body);
|
|
265
|
+
_$jscoverage['response.js'][134]++;
|
|
266
|
+
return this;
|
|
267
|
+
});
|
|
268
|
+
_$jscoverage['response.js'][153]++;
|
|
269
|
+
res.json = (function (obj) {
|
|
270
|
+
_$jscoverage['response.js'][155]++;
|
|
271
|
+
if (2 == arguments.length) {
|
|
272
|
+
_$jscoverage['response.js'][156]++;
|
|
273
|
+
this.statusCode = obj;
|
|
274
|
+
_$jscoverage['response.js'][157]++;
|
|
275
|
+
obj = arguments[1];
|
|
276
|
+
}
|
|
277
|
+
_$jscoverage['response.js'][160]++;
|
|
278
|
+
var settings = this.app.settings, jsonp = settings["jsonp callback"], replacer = settings["json replacer"], spaces = settings["json spaces"], body = JSON.stringify(obj, replacer, spaces), callback = this.req.query.callback;
|
|
279
|
+
_$jscoverage['response.js'][167]++;
|
|
280
|
+
this.charset = this.charset || "utf-8";
|
|
281
|
+
_$jscoverage['response.js'][168]++;
|
|
282
|
+
this.set("Content-Type", "application/json");
|
|
283
|
+
_$jscoverage['response.js'][170]++;
|
|
284
|
+
if (callback && jsonp) {
|
|
285
|
+
_$jscoverage['response.js'][171]++;
|
|
286
|
+
this.set("Content-Type", "text/javascript");
|
|
287
|
+
_$jscoverage['response.js'][172]++;
|
|
288
|
+
body = callback.replace(/[^\w$.]/g, "") + "(" + body + ");";
|
|
289
|
+
}
|
|
290
|
+
_$jscoverage['response.js'][175]++;
|
|
291
|
+
return this.send(body);
|
|
292
|
+
});
|
|
293
|
+
_$jscoverage['response.js'][198]++;
|
|
294
|
+
res.sendfile = (function (path, options, fn) {
|
|
295
|
+
_$jscoverage['response.js'][199]++;
|
|
296
|
+
var self = this, req = self.req, next = this.req.next, options = options || {};
|
|
297
|
+
_$jscoverage['response.js'][205]++;
|
|
298
|
+
if ("function" == typeof options) {
|
|
299
|
+
_$jscoverage['response.js'][206]++;
|
|
300
|
+
fn = options;
|
|
301
|
+
_$jscoverage['response.js'][207]++;
|
|
302
|
+
options = {};
|
|
303
|
+
}
|
|
304
|
+
_$jscoverage['response.js'][211]++;
|
|
305
|
+
options.callback = (function (err) {
|
|
306
|
+
_$jscoverage['response.js'][212]++;
|
|
307
|
+
if (err) {
|
|
308
|
+
_$jscoverage['response.js'][214]++;
|
|
309
|
+
if ("ENOENT" == err.code) {
|
|
310
|
+
_$jscoverage['response.js'][214]++;
|
|
311
|
+
err = 404;
|
|
312
|
+
}
|
|
313
|
+
_$jscoverage['response.js'][219]++;
|
|
314
|
+
if ("number" == typeof err) {
|
|
315
|
+
_$jscoverage['response.js'][219]++;
|
|
316
|
+
err = utils.error(err);
|
|
317
|
+
}
|
|
318
|
+
_$jscoverage['response.js'][222]++;
|
|
319
|
+
if (! self.headerSent) {
|
|
320
|
+
_$jscoverage['response.js'][222]++;
|
|
321
|
+
self.removeHeader("Content-Disposition");
|
|
322
|
+
}
|
|
323
|
+
_$jscoverage['response.js'][225]++;
|
|
324
|
+
if (fn) {
|
|
325
|
+
_$jscoverage['response.js'][225]++;
|
|
326
|
+
return fn(err);
|
|
327
|
+
}
|
|
328
|
+
_$jscoverage['response.js'][228]++;
|
|
329
|
+
if (self.headerSent) {
|
|
330
|
+
_$jscoverage['response.js'][228]++;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
_$jscoverage['response.js'][230]++;
|
|
334
|
+
return req.next(err);
|
|
335
|
+
}
|
|
336
|
+
_$jscoverage['response.js'][233]++;
|
|
337
|
+
fn && fn();
|
|
338
|
+
});
|
|
339
|
+
_$jscoverage['response.js'][237]++;
|
|
340
|
+
options.path = encodeURIComponent(path);
|
|
341
|
+
_$jscoverage['response.js'][238]++;
|
|
342
|
+
send(this.req, this, next, options);
|
|
343
|
+
});
|
|
344
|
+
_$jscoverage['response.js'][255]++;
|
|
345
|
+
res.download = (function (path, filename, fn) {
|
|
346
|
+
_$jscoverage['response.js'][257]++;
|
|
347
|
+
if ("function" == typeof filename) {
|
|
348
|
+
_$jscoverage['response.js'][258]++;
|
|
349
|
+
fn = filename;
|
|
350
|
+
_$jscoverage['response.js'][259]++;
|
|
351
|
+
filename = null;
|
|
352
|
+
}
|
|
353
|
+
_$jscoverage['response.js'][262]++;
|
|
354
|
+
return this.attachment(filename || path).sendfile(path, fn);
|
|
355
|
+
});
|
|
356
|
+
_$jscoverage['response.js'][285]++;
|
|
357
|
+
res.contentType = res.type = (function (type) {
|
|
358
|
+
_$jscoverage['response.js'][287]++;
|
|
359
|
+
return this.set("Content-Type", mime.lookup(type));
|
|
360
|
+
});
|
|
361
|
+
_$jscoverage['response.js'][341]++;
|
|
362
|
+
res.format = (function (obj) {
|
|
363
|
+
_$jscoverage['response.js'][342]++;
|
|
364
|
+
var keys = Object.keys(obj), types = [], req = this.req, next = req.next, accepted = req.accepted, acceptedlen = accepted.length, type, key;
|
|
365
|
+
_$jscoverage['response.js'][352]++;
|
|
366
|
+
if (acceptedlen) {
|
|
367
|
+
_$jscoverage['response.js'][353]++;
|
|
368
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
369
|
+
_$jscoverage['response.js'][354]++;
|
|
370
|
+
types.push(~ keys[i].indexOf("/")? keys[i]: mime.lookup(keys[i]));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
_$jscoverage['response.js'][361]++;
|
|
374
|
+
out:
|
|
375
|
+
for (var i = 0; i < acceptedlen; ++i) {
|
|
376
|
+
_$jscoverage['response.js'][363]++;
|
|
377
|
+
for (var j = 0, jlen = types.length; j < jlen; ++j) {
|
|
378
|
+
_$jscoverage['response.js'][364]++;
|
|
379
|
+
if (accept(types[j].split("/"), accepted[i])) {
|
|
380
|
+
_$jscoverage['response.js'][365]++;
|
|
381
|
+
key = keys[j];
|
|
382
|
+
_$jscoverage['response.js'][366]++;
|
|
383
|
+
type = types[j];
|
|
384
|
+
_$jscoverage['response.js'][367]++;
|
|
385
|
+
break out;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
_$jscoverage['response.js'][373]++;
|
|
390
|
+
if (! acceptedlen) {
|
|
391
|
+
_$jscoverage['response.js'][374]++;
|
|
392
|
+
key = keys[0];
|
|
393
|
+
_$jscoverage['response.js'][375]++;
|
|
394
|
+
type = types[0];
|
|
395
|
+
}
|
|
396
|
+
_$jscoverage['response.js'][378]++;
|
|
397
|
+
if (key) {
|
|
398
|
+
_$jscoverage['response.js'][379]++;
|
|
399
|
+
this.set("Content-Type", type);
|
|
400
|
+
_$jscoverage['response.js'][380]++;
|
|
401
|
+
obj[key](req, this, next);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
_$jscoverage['response.js'][382]++;
|
|
405
|
+
var err = new Error("Not Acceptable");
|
|
406
|
+
_$jscoverage['response.js'][383]++;
|
|
407
|
+
err.status = 406;
|
|
408
|
+
_$jscoverage['response.js'][384]++;
|
|
409
|
+
err.types = types;
|
|
410
|
+
_$jscoverage['response.js'][385]++;
|
|
411
|
+
next(err);
|
|
412
|
+
}
|
|
413
|
+
_$jscoverage['response.js'][388]++;
|
|
414
|
+
return this;
|
|
415
|
+
});
|
|
416
|
+
_$jscoverage['response.js'][399]++;
|
|
417
|
+
res.attachment = (function (filename) {
|
|
418
|
+
_$jscoverage['response.js'][400]++;
|
|
419
|
+
if (filename) {
|
|
420
|
+
_$jscoverage['response.js'][400]++;
|
|
421
|
+
this.type(filename);
|
|
422
|
+
}
|
|
423
|
+
_$jscoverage['response.js'][401]++;
|
|
424
|
+
this.set("Content-Disposition", filename? "attachment; filename=\"" + basename(filename) + "\"": "attachment");
|
|
425
|
+
_$jscoverage['response.js'][404]++;
|
|
426
|
+
return this;
|
|
427
|
+
});
|
|
428
|
+
_$jscoverage['response.js'][422]++;
|
|
429
|
+
res.set = (function (field, val) {
|
|
430
|
+
_$jscoverage['response.js'][423]++;
|
|
431
|
+
if (2 == arguments.length) {
|
|
432
|
+
_$jscoverage['response.js'][424]++;
|
|
433
|
+
this.setHeader(field, val);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
_$jscoverage['response.js'][426]++;
|
|
437
|
+
for (var key in field) {
|
|
438
|
+
_$jscoverage['response.js'][427]++;
|
|
439
|
+
this.setHeader(key, field[key]);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
_$jscoverage['response.js'][430]++;
|
|
443
|
+
return this;
|
|
444
|
+
});
|
|
445
|
+
_$jscoverage['response.js'][441]++;
|
|
446
|
+
res.get = (function (field) {
|
|
447
|
+
_$jscoverage['response.js'][442]++;
|
|
448
|
+
return this.getHeader(field);
|
|
449
|
+
});
|
|
450
|
+
_$jscoverage['response.js'][454]++;
|
|
451
|
+
res.clearCookie = (function (name, options) {
|
|
452
|
+
_$jscoverage['response.js'][455]++;
|
|
453
|
+
var opts = {expires: new Date(1), path: "/"};
|
|
454
|
+
_$jscoverage['response.js'][456]++;
|
|
455
|
+
return this.cookie(name, "", options? utils.merge(opts, options): opts);
|
|
456
|
+
});
|
|
457
|
+
_$jscoverage['response.js'][471]++;
|
|
458
|
+
res.signedCookie = (function (name, val, options) {
|
|
459
|
+
_$jscoverage['response.js'][472]++;
|
|
460
|
+
var secret = this.req.secret;
|
|
461
|
+
_$jscoverage['response.js'][473]++;
|
|
462
|
+
if (! secret) {
|
|
463
|
+
_$jscoverage['response.js'][473]++;
|
|
464
|
+
throw new Error("connect.cookieParser(\"secret\") required for signed cookies");
|
|
465
|
+
}
|
|
466
|
+
_$jscoverage['response.js'][474]++;
|
|
467
|
+
if ("object" == typeof val) {
|
|
468
|
+
_$jscoverage['response.js'][474]++;
|
|
469
|
+
val = "j:" + JSON.stringify(val);
|
|
470
|
+
}
|
|
471
|
+
_$jscoverage['response.js'][475]++;
|
|
472
|
+
val = utils.sign(val, secret);
|
|
473
|
+
_$jscoverage['response.js'][476]++;
|
|
474
|
+
return this.cookie(name, val, options);
|
|
475
|
+
});
|
|
476
|
+
_$jscoverage['response.js'][501]++;
|
|
477
|
+
res.cookie = (function (name, val, options) {
|
|
478
|
+
_$jscoverage['response.js'][502]++;
|
|
479
|
+
options = options || {};
|
|
480
|
+
_$jscoverage['response.js'][503]++;
|
|
481
|
+
if ("object" == typeof val) {
|
|
482
|
+
_$jscoverage['response.js'][503]++;
|
|
483
|
+
val = "j:" + JSON.stringify(val);
|
|
484
|
+
}
|
|
485
|
+
_$jscoverage['response.js'][504]++;
|
|
486
|
+
if ("maxAge" in options) {
|
|
487
|
+
_$jscoverage['response.js'][504]++;
|
|
488
|
+
options.expires = new Date(Date.now() + options.maxAge);
|
|
489
|
+
}
|
|
490
|
+
_$jscoverage['response.js'][505]++;
|
|
491
|
+
if (null == options.path) {
|
|
492
|
+
_$jscoverage['response.js'][505]++;
|
|
493
|
+
options.path = "/";
|
|
494
|
+
}
|
|
495
|
+
_$jscoverage['response.js'][506]++;
|
|
496
|
+
var cookie = utils.serializeCookie(name, val, options);
|
|
497
|
+
_$jscoverage['response.js'][507]++;
|
|
498
|
+
this.set("Set-Cookie", cookie);
|
|
499
|
+
_$jscoverage['response.js'][508]++;
|
|
500
|
+
return this;
|
|
501
|
+
});
|
|
502
|
+
_$jscoverage['response.js'][543]++;
|
|
503
|
+
res.redirect = (function (url) {
|
|
504
|
+
_$jscoverage['response.js'][544]++;
|
|
505
|
+
var app = this.app, req = this.req, head = "HEAD" == req.method, status = 302, body;
|
|
506
|
+
_$jscoverage['response.js'][551]++;
|
|
507
|
+
if (2 == arguments.length) {
|
|
508
|
+
_$jscoverage['response.js'][552]++;
|
|
509
|
+
status = url;
|
|
510
|
+
_$jscoverage['response.js'][553]++;
|
|
511
|
+
url = arguments[1];
|
|
512
|
+
}
|
|
513
|
+
_$jscoverage['response.js'][557]++;
|
|
514
|
+
var map = {back: req.get("Referrer") || "/"};
|
|
515
|
+
_$jscoverage['response.js'][560]++;
|
|
516
|
+
url = map[url] || url;
|
|
517
|
+
_$jscoverage['response.js'][563]++;
|
|
518
|
+
if (! ~ url.indexOf("://")) {
|
|
519
|
+
_$jscoverage['response.js'][564]++;
|
|
520
|
+
var path = app.path();
|
|
521
|
+
_$jscoverage['response.js'][567]++;
|
|
522
|
+
if (0 == url.indexOf("./") || 0 == url.indexOf("..")) {
|
|
523
|
+
_$jscoverage['response.js'][568]++;
|
|
524
|
+
url = req.path + "/" + url;
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
_$jscoverage['response.js'][570]++;
|
|
528
|
+
if ("/" != url[0]) {
|
|
529
|
+
_$jscoverage['response.js'][571]++;
|
|
530
|
+
url = path + "/" + url;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
_$jscoverage['response.js'][575]++;
|
|
534
|
+
var host = req.get("Host");
|
|
535
|
+
_$jscoverage['response.js'][576]++;
|
|
536
|
+
url = req.protocol + "://" + host + url;
|
|
537
|
+
}
|
|
538
|
+
_$jscoverage['response.js'][580]++;
|
|
539
|
+
this.format({"text/plain": (function () {
|
|
540
|
+
_$jscoverage['response.js'][582]++;
|
|
541
|
+
body = statusCodes[status] + ". Redirecting to " + url;
|
|
542
|
+
}), "text/html": (function () {
|
|
543
|
+
_$jscoverage['response.js'][586]++;
|
|
544
|
+
body = "<p>" + statusCodes[status] + ". Redirecting to <a href=\"" + url + "\">" + url + "</a></p>";
|
|
545
|
+
})});
|
|
546
|
+
_$jscoverage['response.js'][591]++;
|
|
547
|
+
this.statusCode = status;
|
|
548
|
+
_$jscoverage['response.js'][592]++;
|
|
549
|
+
this.set("Location", url);
|
|
550
|
+
_$jscoverage['response.js'][593]++;
|
|
551
|
+
this.end(head? null: body);
|
|
552
|
+
});
|
|
553
|
+
_$jscoverage['response.js'][617]++;
|
|
554
|
+
res.render = (function (view, options, fn) {
|
|
555
|
+
_$jscoverage['response.js'][618]++;
|
|
556
|
+
var self = this, options = options || {}, req = this.req, app = req.app;
|
|
557
|
+
_$jscoverage['response.js'][624]++;
|
|
558
|
+
if ("function" == typeof options) {
|
|
559
|
+
_$jscoverage['response.js'][625]++;
|
|
560
|
+
fn = options, options = {};
|
|
561
|
+
}
|
|
562
|
+
_$jscoverage['response.js'][628]++;
|
|
563
|
+
function render() {
|
|
564
|
+
_$jscoverage['response.js'][630]++;
|
|
565
|
+
options.locals = self.locals;
|
|
566
|
+
_$jscoverage['response.js'][633]++;
|
|
567
|
+
fn = fn || (function (err, str) {
|
|
568
|
+
_$jscoverage['response.js'][634]++;
|
|
569
|
+
if (err) {
|
|
570
|
+
_$jscoverage['response.js'][634]++;
|
|
571
|
+
return req.next(err);
|
|
572
|
+
}
|
|
573
|
+
_$jscoverage['response.js'][635]++;
|
|
574
|
+
self.send(str);
|
|
575
|
+
});
|
|
576
|
+
_$jscoverage['response.js'][639]++;
|
|
577
|
+
app.render(view, options, fn);
|
|
578
|
+
}
|
|
579
|
+
_$jscoverage['response.js'][643]++;
|
|
580
|
+
var callbacks = app.viewCallbacks, pending = callbacks.length, len = pending, done;
|
|
581
|
+
_$jscoverage['response.js'][648]++;
|
|
582
|
+
if (len) {
|
|
583
|
+
_$jscoverage['response.js'][649]++;
|
|
584
|
+
for (var i = 0; i < len; ++i) {
|
|
585
|
+
_$jscoverage['response.js'][650]++;
|
|
586
|
+
callbacks[i](req, self, (function (err) {
|
|
587
|
+
_$jscoverage['response.js'][651]++;
|
|
588
|
+
if (done) {
|
|
589
|
+
_$jscoverage['response.js'][651]++;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
_$jscoverage['response.js'][653]++;
|
|
593
|
+
if (err) {
|
|
594
|
+
_$jscoverage['response.js'][654]++;
|
|
595
|
+
req.next(err);
|
|
596
|
+
_$jscoverage['response.js'][655]++;
|
|
597
|
+
done = true;
|
|
598
|
+
_$jscoverage['response.js'][656]++;
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
_$jscoverage['response.js'][659]++;
|
|
602
|
+
--pending || render();
|
|
603
|
+
}));
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
_$jscoverage['response.js'][663]++;
|
|
608
|
+
render();
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
_$jscoverage['response.js'].source = ["","/*!"," * Express - response"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var fs = require('fs')"," , http = require('http')"," , path = require('path')"," , connect = require('connect')"," , utils = connect.utils"," , accept = require('./utils').accept"," , statusCodes = http.STATUS_CODES"," , send = connect.static.send"," , mime = require('mime')"," , basename = path.basename"," , join = path.join;","","/**"," * Response prototype."," */","","var res = module.exports = {"," __proto__: http.ServerResponse.prototype","};","","/**"," * Set status `code`."," *"," * @param {Number} code"," * @return {ServerResponse}"," * @api public"," */","","res.status = function(code){"," this.statusCode = code;"," return this;","};","","/**"," * Set Cache-Control to the given `type` and `options`."," *"," * Options:"," *"," * - `maxAge` in milliseconds"," *"," * @param {String} type"," * @param {Object} options"," * @return {ServerResponse}"," * @api public"," */","","res.cache = function(type, options){"," var val = type;"," options = options || {};"," if (options.maxAge) val += ', max-age=' + (options.maxAge / 1000); "," return this.set('Cache-Control', val);","};","","/**"," * Send a response."," *"," * Examples:"," *"," * res.send(new Buffer('wahoo'));"," * res.send({ some: 'json' });"," * res.send('<p>some html</p>');"," * res.send(404, 'Sorry, cant find that');"," * res.send(404);"," *"," * @param {Mixed} body or status"," * @param {Mixed} body"," * @return {ServerResponse}"," * @api public"," */","","res.send = function(body){"," var req = this.req"," , head = 'HEAD' == req.method;",""," // allow status / body"," if (2 == arguments.length) {"," this.statusCode = body;"," body = arguments[1];"," }",""," switch (typeof body) {"," // response status"," case 'number':"," this.get('Content-Type') || this.contentType('.txt');"," this.statusCode = body;"," body = http.STATUS_CODES[body];"," break;"," // string defaulting to html"," case 'string':"," if (!this.get('Content-Type')) {"," this.charset = this.charset || 'utf-8';"," this.contentType('.html');"," }"," break;"," case 'boolean':"," case 'object':"," if (null == body) {"," body = '';"," } else if (Buffer.isBuffer(body)) {"," this.get('Content-Type') || this.contentType('.bin');"," } else {"," return this.json(body);"," }"," break;"," }",""," // populate Content-Length"," if (undefined !== body && !this.get('Content-Length')) {"," this.set('Content-Length', Buffer.isBuffer(body)"," ? body.length"," : Buffer.byteLength(body));"," }",""," // strip irrelevant headers"," if (204 == this.statusCode || 304 == this.statusCode) {"," this.removeHeader('Content-Type');"," this.removeHeader('Content-Length');"," body = '';"," }",""," // respond"," this.end(head ? null : body);"," return this;","};","","/**"," * Send JSON response."," *"," * Examples:"," *"," * res.json(null);"," * res.json({ user: 'tj' });"," * res.json(500, 'oh noes!');"," * res.json(404, 'I dont have that');"," *"," * @param {Mixed} obj or status"," * @param {Mixed} obj"," * @return {ServerResponse}"," * @api public"," */","","res.json = function(obj){"," // allow status / body"," if (2 == arguments.length) {"," this.statusCode = obj;"," obj = arguments[1];"," }",""," var settings = this.app.settings"," , jsonp = settings['jsonp callback']"," , replacer = settings['json replacer']"," , spaces = settings['json spaces']"," , body = JSON.stringify(obj, replacer, spaces)"," , callback = this.req.query.callback;",""," this.charset = this.charset || 'utf-8';"," this.set('Content-Type', 'application/json');",""," if (callback && jsonp) {"," this.set('Content-Type', 'text/javascript');"," body = callback.replace(/[^\\w$.]/g, '') + '(' + body + ');';"," }",""," return this.send(body);","};","","/**"," * Transfer the file at the given `path`."," * "," * Automatically sets the _Content-Type_ response header field."," * The callback `fn(err)` is invoked when the transfer is complete"," * or when an error occurs. Be sure to check `res.sentHeader`"," * if you wish to attempt responding, as the header and some data"," * may have already been transferred."," *"," * Options:"," *"," * - `maxAge` defaulting to 0"," * - `root` root directory for relative filenames"," *"," * @param {String} path"," * @param {Object|Function} options or fn"," * @param {Function} fn"," * @api public"," */","","res.sendfile = function(path, options, fn){"," var self = this"," , req = self.req"," , next = this.req.next"," , options = options || {};",""," // support function as second arg"," if ('function' == typeof options) {"," fn = options;"," options = {};"," }",""," // callback"," options.callback = function(err){"," if (err) {"," // cast ENOENT"," if ('ENOENT' == err.code) err = 404;",""," // coerce numeric error to an Error"," // TODO: remove"," // TODO: remove docs for headerSent?"," if ('number' == typeof err) err = utils.error(err);",""," // ditch content-disposition to prevent funky responses"," if (!self.headerSent) self.removeHeader('Content-Disposition');",""," // woot! callback available"," if (fn) return fn(err);",""," // lost in limbo if there's no callback"," if (self.headerSent) return;",""," return req.next(err);"," }",""," fn && fn();"," };",""," // transfer"," options.path = encodeURIComponent(path);"," send(this.req, this, next, options);","};","","/**"," * Transfer the file at the given `path` as an attachment."," *"," * Optionally providing an alternate attachment `filename`,"," * and optional callback `fn(err)`. The callback is invoked"," * when the data transfer is complete, or when an error has"," * ocurred. Be sure to check `res.headerSent` if you plan to respond."," *"," * @param {String} path"," * @param {String|Function} filename or fn"," * @param {Function} fn"," * @api public"," */","","res.download = function(path, filename, fn){"," // support function as second arg"," if ('function' == typeof filename) {"," fn = filename;"," filename = null;"," }",""," return this.attachment(filename || path).sendfile(path, fn);","};","","/**"," * Set _Content-Type_ response header passed through `mime.lookup()`."," *"," * Examples:"," *"," * var filename = 'path/to/image.png';"," * res.contentType(filename);"," * // res.headers['Content-Type'] is now \"image/png\""," *"," * res.contentType('.html');"," * res.contentType('html');"," * res.contentType('json');"," * res.contentType('png');"," * res.type('png');"," *"," * @param {String} type"," * @return {ServerResponse} for chaining"," * @api public"," */","","res.contentType =","res.type = function(type){"," return this.set('Content-Type', mime.lookup(type));","};","","/**"," * Respond to the Acceptable formats using an `obj`"," * of mime-type callbacks."," *"," * This method uses `req.accepted`, an array of"," * acceptable types ordered by their quality values."," * When \"Accept\" is not present the _first_ callback"," * is invoked, otherwise the first match is used. When"," * no match is performed the server responds with"," * 406 \"Not Acceptable\"."," *"," * Content-Type is set for you, however if you choose"," * you may alter this within the callback using `res.type()`"," * or `res.set('Content-Type', ...)`."," *"," * res.format({"," * 'text/plain': function(){"," * res.send('hey');"," * },"," * "," * 'text/html': function(){"," * res.send('<p>hey</p>');"," * },"," * "," * 'appliation/json': function(){"," * res.send({ message: 'hey' });"," * }"," * });"," *"," * In addition to canonicalized MIME types you may"," * also use extnames mapped to these types:"," *"," * res.format({"," * text: function(){"," * res.send('hey');"," * },"," * "," * html: function(){"," * res.send('<p>hey</p>');"," * },"," * "," * json: function(){"," * res.send({ message: 'hey' });"," * }"," * });"," *"," * @param {Object} obj"," * @return {ServerResponse} for chaining"," * @api public"," */","","res.format = function(obj){"," var keys = Object.keys(obj)"," , types = []"," , req = this.req"," , next = req.next"," , accepted = req.accepted"," , acceptedlen = accepted.length"," , type"," , key;",""," // normalize extnames -> mime"," if (acceptedlen) {"," for (var i = 0; i < keys.length; ++i) {"," types.push(~keys[i].indexOf('/')"," ? keys[i]"," : mime.lookup(keys[i]));"," }"," }",""," // determine most acceptable format"," out:"," for (var i = 0; i < acceptedlen; ++i) {"," for (var j = 0, jlen = types.length; j < jlen; ++j) {"," if (accept(types[j].split('/'), accepted[i])) {"," key = keys[j];"," type = types[j];"," break out;"," }"," }"," }",""," // default to the first"," if (!acceptedlen) {"," key = keys[0];"," type = types[0];"," }",""," if (key) {"," this.set('Content-Type', type);"," obj[key](req, this, next);"," } else {"," var err = new Error('Not Acceptable');"," err.status = 406;"," err.types = types;"," next(err);"," }",""," return this;","};","","/**"," * Set _Content-Disposition_ header to _attachment_ with optional `filename`."," *"," * @param {String} filename"," * @return {ServerResponse}"," * @api public"," */","","res.attachment = function(filename){"," if (filename) this.type(filename);"," this.set('Content-Disposition', filename"," ? 'attachment; filename=\"' + basename(filename) + '\"'"," : 'attachment');"," return this;","};","","/**"," * Set header `field` to `val`, or pass"," * an object of of header fields."," *"," * Examples:"," *"," * res.set('Accept', 'application/json');"," * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });"," *"," * @param {String|Object} field"," * @param {String} val"," * @return {ServerResponse} for chaining"," * @api public"," */","","res.set = function(field, val){"," if (2 == arguments.length) {"," this.setHeader(field, val);"," } else {"," for (var key in field) {"," this.setHeader(key, field[key]);"," }"," }"," return this;","};","","/**"," * Get value for header `field`."," *"," * @param {String} field"," * @return {String}"," * @api public"," */","","res.get = function(field){"," return this.getHeader(field);","};","","/**"," * Clear cookie `name`."," *"," * @param {String} name"," * @param {Object} options"," * @param {ServerResponse} for chaining"," * @api public"," */","","res.clearCookie = function(name, options){"," var opts = { expires: new Date(1), path: '/' };"," return this.cookie(name, '', options"," ? utils.merge(opts, options)"," : opts);","};","","/**"," * Set a signed cookie with the given `name` and `val`."," * See `res.cookie()` for details."," *"," * @param {String} name"," * @param {String|Object} val"," * @param {Object} options"," * @api public"," */","","res.signedCookie = function(name, val, options){"," var secret = this.req.secret;"," if (!secret) throw new Error('connect.cookieParser(\"secret\") required for signed cookies');"," if ('object' == typeof val) val = 'j:' + JSON.stringify(val);"," val = utils.sign(val, secret);"," return this.cookie(name, val, options);","};","","/**"," * Set cookie `name` to `val`, with the given `options`."," *"," * Options:"," *"," * - `maxAge` max-age in milliseconds, converted to `expires`"," * - `path` defaults to \"/\""," *"," * Examples:"," *"," * // \"Remember Me\" for 15 minutes"," * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });"," *"," * // save as above"," * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })"," *"," * @param {String} name"," * @param {String|Object} val"," * @param {Options} options"," * @api public"," */","","res.cookie = function(name, val, options){"," options = options || {};"," if ('object' == typeof val) val = 'j:' + JSON.stringify(val);"," if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);"," if (null == options.path) options.path = '/';"," var cookie = utils.serializeCookie(name, val, options);"," this.set('Set-Cookie', cookie);"," return this;","};","","/**"," * Redirect to the given `url` with optional response `status`"," * defaulting to 302."," *"," * The given `url` can also be the name of a mapped url, for"," * example by default express supports \"back\" which redirects"," * to the _Referrer_ or _Referer_ headers or \"/\"."," *"," * Examples:"," *"," * res.redirect('/foo/bar');"," * res.redirect('http://example.com');"," * res.redirect(301, 'http://example.com');"," *"," * Mounting:"," *"," * When an application is mounted, and `res.redirect()`"," * is given a path that does _not_ lead with \"/\". For "," * example suppose a \"blog\" app is mounted at \"/blog\","," * the following redirect would result in \"/blog/login\":"," *"," * res.redirect('login');"," *"," * While the leading slash would result in a redirect to \"/login\":"," *"," * res.redirect('/login');"," *"," * @param {String} url"," * @param {Number} code"," * @api public"," */","","res.redirect = function(url){"," var app = this.app"," , req = this.req"," , head = 'HEAD' == req.method"," , status = 302"," , body;",""," // allow status / url"," if (2 == arguments.length) {"," status = url;"," url = arguments[1];"," }",""," // setup redirect map"," var map = { back: req.get('Referrer') || '/' };",""," // perform redirect"," url = map[url] || url;",""," // relative"," if (!~url.indexOf('://')) {"," var path = app.path();",""," // relative to path"," if (0 == url.indexOf('./') || 0 == url.indexOf('..')) {"," url = req.path + '/' + url;"," // relative to mount-point"," } else if ('/' != url[0]) {"," url = path + '/' + url;"," }",""," // Absolute"," var host = req.get('Host');"," url = req.protocol + '://' + host + url;"," }",""," // Support text/{plain,html} by default"," this.format({"," 'text/plain': function(){"," body = statusCodes[status] + '. Redirecting to ' + url;"," },",""," 'text/html': function(){"," body = '<p>' + statusCodes[status] + '. Redirecting to <a href=\"' + url + '\">' + url + '</a></p>';"," }"," })",""," // Respond"," this.statusCode = status;"," this.set('Location', url);"," this.end(head ? null : body);","};","","/**"," * Render `view` with the given `options` and optional callback `fn`."," * When a callback function is given a response will _not_ be made"," * automatically, otherwise a response of _200_ and _text/html_ is given."," *"," * Options:"," * "," * - `status` Response status code (`res.statusCode`)"," * - `charset` Set the charset (`res.charset`)"," *"," * Reserved locals:"," *"," * - `cache` boolean hinting to the engine it should cache"," * - `filename` filename of the view being rendered"," *"," * @param {String} view"," * @param {Object|Function} options or callback function"," * @param {Function} fn"," * @api public"," */","","res.render = function(view, options, fn){"," var self = this"," , options = options || {}"," , req = this.req"," , app = req.app;",""," // support callback function as second arg"," if ('function' == typeof options) {"," fn = options, options = {};"," }",""," function render() {"," // merge res.locals"," options.locals = self.locals;",""," // default callback to respond"," fn = fn || function(err, str){"," if (err) return req.next(err);"," self.send(str);"," };",""," // render"," app.render(view, options, fn);"," }",""," // invoke view callbacks"," var callbacks = app.viewCallbacks"," , pending = callbacks.length"," , len = pending"," , done;",""," if (len) {"," for (var i = 0; i < len; ++i) {"," callbacks[i](req, self, function(err){"," if (done) return;",""," if (err) {"," req.next(err);"," done = true;"," return;"," }",""," --pending || render();"," });"," }"," } else {"," render();"," }","};"];
|