blazor-hosted

Blazor's WebApi returns text/html instead of application/json

南楼画角 提交于 2021-02-05 07:21:26
问题 My controller's methods in Blazor's server side WebApi returns an html/text response instead of application/json which leds to The provided ContentType is not supported; the supported types are 'application/json' and the structured syntax suffix 'application/+json'. error. What is the best way to manually set the content type of the response to application/json? My Controller with a Get method [Route("api/[controller]")] [ApiController] public class DeveloperController : ControllerBase {