Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 0bf35df

Browse files
committed
Add stress test server API
1 parent 646399f commit 0bf35df

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test-server/server.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ app.delete('/hey', function(req, res) {
108108
res.send('man')
109109
})
110110

111+
app.get('/stress/:id', function(req, res) {
112+
res.sendFile(process.cwd() + '/public/github.png')
113+
})
114+
111115
app.post('/mime', mimeCheck)
112116
app.put('/mime', mimeCheck)
113117

@@ -137,13 +141,16 @@ app.all('/xhr-header', (req, res) => {
137141
res.send(req.headers)
138142
})
139143

140-
app.post('/upload', bodyParser.urlencoded({ extended: true }), (req, res) => {
144+
app.post('/upload', bodyParser.urlencoded({ extended : true }), (req, res) => {
141145
console.log(JSON.stringify(req.headers))
142146
console.log(JSON.stringify(req.body))
143147
res.status(200).send(req.body)
144148
})
145149

146-
app.all('/timeout', (res, req) => {
150+
app.all('/timeout', (req, res) => {
151+
setTimeout(function() {
152+
res.status(408).send('request timed out.')
153+
}, 5000)
147154

148155
})
149156

0 commit comments

Comments
 (0)