Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Nov 24, 2024
1 parent 6b449ab commit 05d2f27
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = class Router extends EventEmitter {

for(let method of methods) {
this[method] = (path, ...callbacks) => {
this.createRoute(method.toUpperCase(), path, this, ...callbacks);
return this.createRoute(method.toUpperCase(), path, this, ...callbacks);
};
};
}
Expand Down
25 changes: 25 additions & 0 deletions tests/tests/app/app-chaining.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// must support app chaining

const express = require("express");

const app = express();

app.use((req, res, next) => {
res.setHeader('a', '1')
next();
}).use((req, res, next) => {
res.setHeader('b', '1')
next();
}).post('/abc', (req, res) => {
res.send('abc');
}).get('/def', (req, res) => {
res.send('def');
});

app.listen(13333, async () => {
const output = await fetch('http://localhost:13333/abc', { method: 'POST' });
console.log(output.headers.get('etag'), await output.text());
const output2 = await fetch('http://localhost:13333/def');
console.log(output2.headers.get('etag'), await output2.text());
process.exit(0);
});
24 changes: 0 additions & 24 deletions tests/tests/app/app-use-chaining.js

This file was deleted.

0 comments on commit 05d2f27

Please sign in to comment.