Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

397
Views
node.js + jQuery, ajax envía una matriz o json al servidor, la carga útil es demasiado grande.

por ejemplo: jQuery:

 var sendTemp=[]; var t={ string:'this is test string1', time: '2017-03-20T04:25:06.584Z', type:'file', location:'usa', broken:false, }

Pruebo la matriz de valor var max para enviar el servidor, cuando max > 500~600 el servidor devuelve un mensaje de error de payload too large problem .

 var max=600; for(var i=0;i<max;i++){ sendTemp.push(t); } $.ajax({ async:false, url:"/send", type:"POST", data:{ sendTemp:JSON.stringify(sendTemp), }, success:function(data){ }, error:function(jqXHR, textStatus, errorThrown){ } });

Encontré una solución pero no funcionó, en app.js

nodo.js:

límite establecido:

 var bodyParser = require('body-parser'); app.use(bodyParser.json({limit: '50mb'})); app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));

establecer puerto:

 app.post('/send',function(req, res, next){ console.log(req.body); res.end(); });
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Me enfrenté al mismo problema. Hice una publicación de ajax y obtuve un error de carga útil 413 demasiado grande. Al verificar la red y la documentación, resolví este problema al establecer el límite directamente en el analizador corporal.

app.use(bodyParser({limit: '50mb'}));

Espero que esto sea útil.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!