从招摇开发者:
我们必须清理HTML,以避免注射标签并启用XSS漏洞 。所以是的,原始html是你应该看到的。
但是,您可以自行更改招摇,ui.js由nicksellen提供
--- swagger-ui.js 2015-09-19 20:58:10.000000000 +0200
+++ swagger-ui.js 2015-11-16 13:45:26.958266568 +0100
@@ -31855,9 +31855,10 @@
// HTML
} else if (contentType === 'text/html') {
- code = $('<code />').html(_.escape(content));
- pre = $('<pre class="xml" />').append(code);
-
+ var iframe = document.createElement('iframe');
+ iframe.srcdoc = content;
+ iframe.style = 'width: 100%; height: 500px;';
+ pre = iframe;
// Plain Text
} else if (/text\/plain/.test(contentType)) {
code = $('<code />').text(content);
代码为https://github.com/swagger-api/swagger-ui/issues/1748
要使用Swashbuckle整合这一变化:
- 从GitHub下载Swashbuckle
- swagger-u i.js位于bower_components \ swagger-ui \ dist文件夹中的Swashbuckle.AspNetCore.SwaggerUI项目中。进行上述编辑并编译。
- 在项目中,删除Swashbuckle NuGet包,加入到步骤中创建的DLL文件的引用2.
由于的NuGet不再管理这个包,这将是由你来定期检查Swashbuckle项目如果你想更新,重复这个过程。
甜蜜的感谢。现在我只需要弄清楚如何将其与Swashbuckle进行整合:) –
编辑答案包括如何与Swashbuckle集成。 –
你是男人:) –