Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

236
Vistas
what is Cors-Policy why it is not allowing me to use content- type in post request of Fecth API in javascript?

it is showing like this when i am running the post request in console

Access to fetch at 'http://dummy.restapiexample.com/api/v1/create' from origin 'http://127.0.0.1:5501' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
tut42.js:57 POST http://dummy.restapiexample.com/api/v1/create net::ERR_FAILED
postData @ tut42.js:57
(anonymous) @ tut42.js:61
tut42.js:57   Uncaught (in promise) TypeError: Failed to fetch
    at postData (tut42.js:57)
    at tut42.js:61
postData @ tut42.js:57
(anonymous) @ tut42.js:61
Promise.then (async)
postData @ tut42.js:58
(anonymous) @ tut42.js:61
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Being a cross domain request the API call seems to be blocked itself can you try adding Access-Control-Allow-Headers individually or you can switch to no-cors mode.

fetch(request, {mode: 'cors'});

For better understanding for CORS kindly check https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS.

And for the different header that you can play in correspondence with Access-Control-Allow-Headers is in the following link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

Access-Control-Allow-Headers: *
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda