Node.js sets Content-Type

http.createServer((request, response) => {
  response.setHeader("Access-Control-Allow-Origin","*")

  request.on("data", data => {
    console.log(data)
  })

  request.on("end", () => {
    console.log(request)
    response.end("success")

  })

}).listen(8088)

during the request, if the parameter is of String type, it can be successful, but if the request is of Object type, an error will be reported:
Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.
how should I write it

Mar.28,2021

you can handle all requests, but option requests cannot set Content-Type headers. You have to set the cors header separately for the option request, and then set the Content-Type header for the normal request to return the response.


add
response.setHeader ('Access-Control-Allow-Headers','*')

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b42a16-2c60d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b42a16-2c60d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?