You use it correctly, but you must tell your internal service to allow custom headers ( X-). For example, in PHP:
header("Access-Control-Allow-Headers: X-Requested-With");
In addition, your custom headers must have a prefix X-. So you should have:
'X-Platform-Version': '1'
, mode cors.
, . , .
var header = new Headers();
header.append('X-Platform-Version', 1);
header.append("Content-Type", "text/plain");
var myInit = {
method: 'GET',
headers: header,
mode: 'cors',
cache: 'default'
}
fetch('http://localhost:3000/api/front_end/v1/login', myInit)
.then(res => {
console.log(res.text())
});