• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

131
Views
response.send no es una función solo en alguna parte de mi código

Tengo este fragmento de código. En algún punto de este código, puedo obtener response.send ... en otros puntos, obtengo el error response.send is not a function . A continuación destaco en qué puntos sucede esto:

 router.post("/*", function (request, response) { if (request.path === "/permissions") { ... if (!error_json) { (async () => { var cookie = request.cookies['JSESSIONID']; var user_cookie = "JSESSIONID=" + cookie; var devices = []; var number; const response = await axios.get("http://10.10.0.145/api/devices", { headers: { 'Cookie': user_cookie } }) for (let i = 0; i < response.data.length; i++) { devices[i] = response.data[i].id; } if (!devices.includes(request.body.deviceId)) { return response.send("Device ID does not exist."); //DOESN'T WORK } else { try { const intervention_found = await tc_interventions.find_intervention(request.body.interventionId); if (intervention_found < 1) { return response.send("Intervention ID does not exist."); //DOESN'T WORK } else { number = await tc_device_intervention.find_device_intervention(request.body.deviceId, request.body.interventionId); if(number < 1){ await tc_device_intervention.insert_device_intervention(request.body.deviceId, request.body.interventionId); } } } catch (err) { console.error(err); } } if(number < 1){ return response.status(201).send(request.body); // WORKS }else{ return response.send("Device-Intervention existing yet."); //WORKS } })(); return; } } });
about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error