mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Add text/plain media type for all json input formatters
This commit is contained in:
parent
f6ee916d7b
commit
6e634d8000
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user