Fix busboy breaking changes (#385)
* fix busboy breaking changes * Ignore security.md
This commit is contained in:
Родитель
ff28f36fe2
Коммит
fb56270932
|
@ -1,2 +1,3 @@
|
|||
dist/
|
||||
coverage/
|
||||
dist/
|
||||
coverage/
|
||||
SECURITY.md
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
// @ts-check
|
||||
var express = require("express");
|
||||
var router = express.Router();
|
||||
var Busboy = require("busboy");
|
||||
var busboy = require("busboy");
|
||||
|
||||
var formData = function (coverage) {
|
||||
coverage["FormdataStreamUploadFile"] = 0;
|
||||
router.post("/stream/uploadfile", function (req, res, next) {
|
||||
var busboy = new Busboy({ headers: req.headers });
|
||||
busboy.on("file", function (fieldname, file, filename, encoding, mimetype) {
|
||||
var bb = busboy({ headers: req.headers });
|
||||
bb.on("file", function (fieldname, file, filename, encoding, mimetype) {
|
||||
console.log(
|
||||
"File [" + fieldname + "]: filename: " + filename + ", encoding: " + encoding + ", mimetype: " + mimetype,
|
||||
);
|
||||
file.pipe(res);
|
||||
coverage["FormdataStreamUploadFile"]++;
|
||||
});
|
||||
busboy.on("field", function (fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) {
|
||||
bb.on("field", function (fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) {
|
||||
console.log("Field [" + fieldname + "]: value: " + val);
|
||||
if (fieldname === "fileContent") {
|
||||
coverage["FormdataStreamUploadFile"]++;
|
||||
res.send(val);
|
||||
}
|
||||
});
|
||||
busboy.on("finish", function () {
|
||||
bb.on("close", function () {
|
||||
console.log("Done parsing form!");
|
||||
res.send();
|
||||
});
|
||||
|
||||
req.pipe(busboy);
|
||||
req.pipe(bb);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@microsoft.azure/autorest.testserver",
|
||||
"version": "3.3.26",
|
||||
"version": "3.3.27",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@microsoft.azure/autorest.testserver",
|
||||
"version": "3.3.26",
|
||||
"version": "3.3.27",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.4",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@microsoft.azure/autorest.testserver",
|
||||
"version": "3.3.27",
|
||||
"version": "3.3.28",
|
||||
"description": "Autorest test server.",
|
||||
"main": "dist/cli/cli.js",
|
||||
"bin": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче