-
-
Notifications
You must be signed in to change notification settings - Fork 683
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
bad content-type header, unknown content-type: text/plain;charset=UTF-8 #495
Comments
const form = new formidable.IncomingForm();
form.parse(req, function(err, fields, files) {
if(err){
console.log(err)
next();
return;
}
next(fields);
}); //html
var xml = new XMLHttpRequest();
xml.open('post', '/bef/upload?f=123')
xml.onload = function(){
console.log(xml.responseText)
}
var json = {
name: 'tom'
}
xml.send(JSON.stringify(json)) |
@maskletter, thanks for reporting. As I understood your "content-type" is "text/plain;charset=UTF-8", right? If I'm mistaken, please correct me. |
return new Promise((resolve, reject) => {
console.log('request')
const form = new formidable.IncomingForm();
form.onPart = function(part) {
if (!part.filename) {
form.handlePart(part);
}
}
form.parse(request, function(err, fields, files) {
if(err){
throw err
}
console.log('aaaaaaaaaaaa')
resolve(fields);
});
}) var xml = new XMLHttpRequest();
xml.open('post', '/user/login2?f=123')
xml.onload = function(){
console.log(xml.responseText)
}
var json = {
name: 'tom'
}
xml.send() This code will output “aaaaaaaaaaaa” var xml = new XMLHttpRequest();
xml.open('post', '/user/login2?f=123')
xml.onload = function(){
console.log(xml.responseText)
}
var json = {
name: 'tom'
}
xml.send(JSON.stringify(json)) This code will not have any output. Is because formidable can't parse JSON.stringify(json), causing no return? |
@maskletter, Yes. |
@xarguments would it be possible to have a fallback for the This individual had the same error that I am having now, where even when uploading a non-text file like a photo the |
Can't receive such data?
The text was updated successfully, but these errors were encountered: