【发布时间】:2018-10-23 11:39:17
【问题描述】:
我想在 Swagger UI 中以 XML 格式而不是 JSON 格式显示响应。我怎样才能做到这一点?这是我要改编的代码:
[SwaggerResponse((int)HttpStatusCode.OK, Type = typeof(FeedModel))]
public async Task<IActionResult> GetCompanyPostFeed(Guid companyId)
{
var feed = new FeedModel();
// Some database requests
return Content(feed, "text/xml", Encoding.UTF8);
}
【问题讨论】:
-
也许尝试设置输入/输出格式化程序?见stackoverflow.com/questions/44371198/…
标签: c# asp.net-core swagger swagger-ui