Closed Aumnia closed 4 years ago
I think I'm fine taking something like this, but I"m not sure I like the name of the method. What is it validating? The format? That it is a valid media type? That it's registered? Why does it return a string and not a bool?
Maybe if we expose a method like IsRegistered
or Contains
, you could do the fallback uourself?
No problem with whatever you want to call the method and have it return. My most basic need is just access to the TypeMap data structure to validate a media type has been registered.
I wrote it this way only because it lets me do:
uploadFile.MimeType = MimeTypes.Validate(source.ContentType)
I always end up adding this to the generated source file so decided I would see if you wanted to add it to the project. It's a dead simple way to ensure uploaded files always have a valid mime-type associated with them.
Thanks for keeping this repo up to date!
/Carl