I'm having trouble to consume a ASP.NET Core 2.2 web api.
This javascript code below works well, I can get all clients fine
fetch('https://10.20.0.20:8081/api/clients/list').then(data => { data.json().then(dt=>{console.log(dt)}) }).catch(error => { console.log(error)});
But this one doesn't work
fetch('https://10.20.0.20:8081/api/clients/list',{ "headers": {"content-type": "application/json"}}).then(data => { data.json().then(dt=>{console.log(dt)}) }).catch(error => { console.log(error)});
Well... It is what I have in my ConfigureServices method from Startup.cs
services.AddCors(setup => setup.AddPolicy("AllowAll", builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials()));
My first line after Configure method from Startup.cs
app.UseCors("AllowAll");