forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpress.js
More file actions
51 lines (43 loc) · 1018 Bytes
/
Copy pathexpress.js
File metadata and controls
51 lines (43 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var express = require('express');
var app = express();
app.get('/some/path', function(req, res) {
res.redirect(req.param("target"));
res.header("Location", req.param("target"));
res.header("Content-Type", "text/plain");
foo(res);
});
function foo(arg) {
arg.header("Access-Control-Allow-Credentials", true);
}
function installRoute(router) {
router.get('/', function(req, res) {
res.send("Go away.");
});
}
installRoute(app);
app.post('/some/other/path', function(req, res) {
req.body;
req.params.foo;
req.query.bar;
req.url;
req.originalUrl;
req.get("foo");
req.header("bar");
req.cookies;
res.cookie('foo', 'bar');
});
app.get('/', require('./exportedHandler.js').handler);
function getHandler() {
return function (req, res){}
}
app.use(getHandler());
function getArrowHandler() {
return (req, res) => f();
}
app.use(getArrowHandler());
app.post('/headers', function(req, res) {
req.headers.baz;
req.host;
req.hostname;
req.headers[config.headerName];
});