dotnet core 5.0 WithExposedHeaders("content-disposition") not working

Viewed 76

I am trying to retrieve the filename from a file upload by accessing the content-disposition.

In my ConfigureServices I have

// enable cors
services.AddCors(opt =>
{
    opt.AddPolicy("CorsPolicy", policy =>
    {
        policy
            .WithOrigins("http://localhost:3000")
            .AllowAnyHeader()
            .WithExposedHeaders("content-disposition")
            .AllowAnyMethod()
            .AllowCredentials()
            .SetIsOriginAllowedToAllowWildcardSubdomains();
    });
});

In my Configure method I have.

// enable cors
app.UseCors("CorsPolicy");

In the response headers I only receive.

headers:
content-length: "21"
content-type: "application/json; charset=utf-8"

What else do I have to check/change in order for this to work?

0 Answers
Related