bench: add /echo endpoint to http_simple

Copies the POST request data verbatim into the response body.
pull/5370/head
Ben Noordhuis 2011-12-30 02:03:08 +01:00
parent 432a2e4d39
commit 8b2abed03d
1 changed files with 6 additions and 0 deletions

View File

@ -54,6 +54,12 @@ var server = http.createServer(function (req, res) {
} else if (command == "fixed") {
body = fixed;
} else if (command == "echo") {
res.writeHead(200, { "Content-Type": "text/plain",
"Transfer-Encoding": "chunked" });
req.pipe(res);
return;
} else {
status = 404;
body = "not found\n";