expressjs / expressjs/multer

Unexpected end of form: Parse text only body with none

Open
#1,168 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

I am having a similar problem to #972 - multer won't parse my upload which doesn't have any files:

```javascript
'use strict';

const express = require('express');
const app = express();

const PORT = 8077;
app.listen(PORT, () => {
console.info(`Started http://localhost:${PORT} (PID: ${process.pid})`);
const multer = require('multer');
const upload = multer();
app.post('/post', upload.none(), (req, res) => {
console.log("POST");
console.log(req.body);
});
postSomething();
});

async function postSomething() {
const fetch = require('node-fetch');
let res = await fetch('http://localhost:8077/post', {
method: 'POST',
credentials: 'include',
headers: {'Content-type': 'multipart/form-data; boundary=abcde12345' },
body: `--abcde12345
Content-Disposition: form-data; name="id"
Content-Type: text/plain
foo
--abcde12345--`
});
console.log(res.status);
}
```

Error: Unexpected end of form

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.