Skip to content

Commit

Permalink
fix test server /echo route
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 18, 2012
1 parent 2c1e86d commit 738fd8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions test/server.js
Expand Up @@ -9,6 +9,12 @@ var app = express();

app.set('json spaces', 0);

app.use(function(req, res, next){
if ('/echo' != req.url) return next();
res.set(req.headers);
req.pipe(res);
});

app.use(express.bodyParser());

app.get('/', function(req, res){
Expand Down Expand Up @@ -71,11 +77,6 @@ app.all('/echo-header/:field', function(req, res){
res.send(req.headers[req.params.field]);
});

app.post('/echo', function(req, res){
res.writeHead(200, req.headers);
req.pipe(res);
});

app.post('/pet', function(req, res){
res.send('added ' + req.body.name + ' the ' + req.body.species);
});
Expand Down
2 changes: 1 addition & 1 deletion test/test.request.js
Expand Up @@ -261,7 +261,7 @@ test('POST json array', function(next){
.post('/echo')
.send([1,2,3])
.end(function(res){
assert('application/json; charset=' == res.header['content-type']);
assert('application/json' == res.header['content-type']);
assert('[1,2,3]' == res.text);
next();
});
Expand Down

0 comments on commit 738fd8e

Please sign in to comment.