Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.JS: Cannot read property 'toString' of undefined (empty request body and files) #601

Open
loretoparisi opened this issue Jan 31, 2022 · 0 comments

Comments

@loretoparisi
Copy link

I have fixed the Node.JS with small deprecated warning, but I'm getting an empty body here:

 $.post = function (req, callback) { 
    var fields = req.body; // <--- this is empty
    var files = req.files; // <--- this is empty
    //...

That is called as usually:

self.app.post(self._options.baseUrl + '/upload', function (req, res) {
                resumableServer.post(req,
                    function (status, filename, original_filename, identifier) {
                        self.logger.debug("upload %s to %s", original_filename, filename);
                        if (status === "done") {
                            var s = fs.createWriteStream(
                                "/root/" + filename
                            );
                            s.on("finish", function () {
                                resumableServer.clean(identifier);
                                res.status(200).send();
                            });
                            resumableServer.write(identifier, s, { end: true });
                        } else {
                            res.status(/^(partly_done|done)$/.test(status) ? 200 : 500).send();
                        }
                    }
                );
            });

while the example client is like this example. Here the whole client gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant