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

284
Views
¿Cómo verificar el código de estado de respuesta de CORS Preflight en js?

¿Hay alguna forma de obtener un código de estado de una respuesta de CORS Preflight? Respuesta de verificación previa

Me gustaría establecer una condición para el estado de la solicitud Preflight.

El código que tengo ahora:

 let requestInCheck = new XMLHttpRequest(); requestInCheck.open("GET", "http://google.COM/", true); //CORS requestInCheck.setRequestHeader('Cache-Control', 'no-cache'); requestInCheck.timeout = TIME_OUT; requestInCheck.onerror = () => { console.log(`There was an error while trying to make the request [STATUS: ${requestInCheck.status}]`); serviceAcception = false; this.setState({ serviceAcception }); } requestInCheck.onload = () => { console.log(`The response code is [STATUS: ${requestInCheck.status}]`); if(requestInCheck.status !== 0) serviceAcception = true; this.setState({ serviceAcception }); } //...send method is below

Dado que la solicitud no se puede responder correctamente, se llama "onerror" y se registra un mensaje respetuoso: Consola

¿Hay alguna manera de que pueda obtener el código de estado de verificación previa en alguna variable o algo?

about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!