-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is your feature request related to a problem? Please describe.
I'm trying to query a YAML file over HTTP (whatever.yml), but the server always returns 404. It works when I change the file extension to json or txt. The file is in the wwwroot folder.
The application is a Blazor WebAssembly project, with no server code. I'm running the project using dotnet watch run; the result is the same when I dotnet run.
Describe the solution you'd like
Give application developers more control over what type of files are served, using configuration.
Assuming that the server returns 404 because no mime-type/mapping for .yml is registered in FileExtensionContentTypeProvider.cs, what about allowing us to add mime-types to the appsettings.json and to the launchSettings.json?
Maybe something like:
{
"staticFiles": {
"contentTypeProvider": {
"mappings": {
".yml": "application/x-yaml", //<-- Add .yml
".mp4": null //<-- Remove .mp4
}
}
}
}Additional context
I don't think that the hacky FileExtensionContentTypeProvider workaround from the documentation is good enough. Moreover, that does not work with Blazor wasm (well if it does, please explain to me what I missed; I'm still new to Blazor wasm).