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
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: *