简体   繁体   English

swagger-editor:找到有效的代码 GET 参数 url

[英]swagger-editor: find the code which works GET parameter url

Steps to run swagger-editor:运行 swagger-editor 的步骤:

git clone git@github.com:swagger-api/swagger-editor.git
cd swagger-editor
npm run dev

Usage:用法:
open url in browser: http://localhost:3200/?url=http://exampleurl.com在浏览器中打开 url:http://localhost:3200/?url=http://exampleurl.com

In this usage, web page from http://exampleurl.com is loaded into editor.在这种用法中,来自http://exampleurl.com的 web 页面被加载到编辑器中。 I can't find code which is responsible for that.我找不到负责的代码。 I've tried to find keywords fetch, url and a few others.我试图找到关键字 fetch、url 和其他一些关键字。 The reason I'm finding the code is need to modify fetch parameters.我找到代码的原因是需要修改获取参数。 Specifically add credentials: 'include' , to be able request gitlab url with preserved session.特别添加credentials: 'include' ,以便能够请求 gitlab url 并保留 session。

Any help would be appreciated, thank you.任何帮助将不胜感激,谢谢。

The ability to pass dynamic query parameters to swagger-ui has been disabled by default since swagger-ui 4.1.3 (included by swagger-editor).swagger-ui 4.1.3 (包含在 swagger-editor 中)起,将动态查询参数传递给 swagger-ui 的功能默认已禁用。 This was done because of a security advisory related to potential phishing.这样做是因为与潜在网络钓鱼相关的安全建议

If you still want to enable the functionality on your swagger-editor, the queryConfigEnabled: true config parameter is what you need.如果您仍想在 swagger-editor 上启用该功能,那么queryConfigEnabled: true配置参数就是您所需要的。 Be aware that this will also allow overwriting other config settings via url params, though the implication is the same as this will run on the client browser, not on the server.请注意,这也将允许通过 url 参数覆盖其他配置设置,尽管这意味着它将在客户端浏览器上运行,而不是在服务器上运行。

If you are using the swagger-editor docker image, you can enable it with something like:如果您使用的是 swagger-editor docker 图像,您可以通过以下方式启用它:

docker run -e QUERY_CONFIG_ENABLED=true -p 8080:8080 swaggerapi/swagger-editor:v4.0.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM