Merge pull request #34415 from chrisgedrim/fix-connect-busboy

connect-busboy - Add busboy to Express.Request interface
This commit is contained in:
Daniel Rosenwasser
2019-04-10 14:11:53 -07:00
committed by GitHub
3 changed files with 19 additions and 1 deletions

View File

@@ -4,3 +4,10 @@ import * as express from 'express';
const options: connectBusboy.ConnectBusboyOptions = { immediate: true };
const result: express.RequestHandler = connectBusboy(options);
const app = express();
app.use(connectBusboy());
app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
req.busboy.on('file', () => {});
});

View File

@@ -1,6 +1,7 @@
// Type definitions for connect-busboy 0.0
// Project: https://github.com/mscdex/connect-busboy
// Definitions by: Pinguet62 <https://github.com/pinguet62>
// Chris Gedrim <https://github.com/chrisgedrim>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -15,4 +16,12 @@ declare namespace connectBusboy {
}
}
declare global {
namespace Express {
interface Request {
busboy: busboy.Busboy;
}
}
}
export = connectBusboy;

View File

@@ -1 +1,3 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json"
}