Implemented interface member:
method
TryGetContentType
Microsoft.AspNetCore.StaticFiles.IContentTypeProvider.TryGetContentType(System.String, out System.String)
10 references to TryGetContentType
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
ComponentsWebAssemblyApplicationBuilderExtensions.cs (1)
121
if (originalPath != null && contentTypeProvider.
TryGetContentType
(originalPath, out var originalContentType))
Microsoft.AspNetCore.StaticFiles.Tests (9)
DefaultContentTypeProviderTests.cs (9)
13
Assert.False(provider.
TryGetContentType
("unknown.ext", out contentType));
20
Assert.True(provider.
TryGetContentType
("known.txt", out var contentType));
29
Assert.False(provider.
TryGetContentType
("known.exe.config", out contentType));
36
Assert.True(provider.
TryGetContentType
("known.dvr-ms", out var contentType));
44
Assert.True(provider.
TryGetContentType
(@"/first/example.txt", out var contentType));
46
Assert.True(provider.
TryGetContentType
(@"\second\example.txt", out contentType));
54
Assert.True(provider.
TryGetContentType
(@"/first.css/example.txt", out var contentType));
56
Assert.True(provider.
TryGetContentType
(@"\second.css\example.txt", out contentType));
65
Assert.True(provider.
TryGetContentType
($"{new string(System.IO.Path.GetInvalidPathChars())}.txt", out contentType));