mirror of
https://github.com/bitwarden/server
synced 2025-12-06 00:03:34 +00:00
Add text/plain media type for all json input formatters
This commit is contained in:
@@ -148,9 +148,13 @@ namespace Bit.Api
|
||||
{
|
||||
config.Filters.Add(new ExceptionHandlerFilterAttribute());
|
||||
config.Filters.Add(new ModelStateValidationFilterAttribute());
|
||||
|
||||
// Allow JSON of content type "text/plain" to avoid cors preflight
|
||||
config.InputFormatters.OfType<JsonInputFormatter>().SingleOrDefault()?
|
||||
.SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("text/plain"));
|
||||
var textPlainMediaType = MediaTypeHeaderValue.Parse("text/plain");
|
||||
foreach(var jsonFormatter in config.InputFormatters.OfType<JsonInputFormatter>())
|
||||
{
|
||||
jsonFormatter.SupportedMediaTypes.Add(textPlainMediaType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user