简体   繁体   中英

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

Steps to run 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

In this usage, web page from http://exampleurl.com is loaded into editor. I can't find code which is responsible for that. I've tried to find keywords fetch, url and a few others. 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.

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). 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. 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.

If you are using the swagger-editor docker image, you can enable it with something like:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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