Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger UI Try out not working #80

Closed
shavo007 opened this issue Sep 22, 2020 · 3 comments
Closed

Swagger UI Try out not working #80

shavo007 opened this issue Sep 22, 2020 · 3 comments

Comments

@shavo007
Copy link

Hi,

When I enable preview mode for swagger UI, i want to test out my API locally via Try it out.

But in vscode i get a console error:

[Embedded Page] Refused to connect to 'http://localhost:8080/documents' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

Not sure if this is related to the extension?

@ak1394
Copy link
Collaborator

ak1394 commented Sep 27, 2020

Hi! This is caused by the tight content security policy used by the extension. I'll see if I can relax it enough to make try it out to work.

@generalov
Copy link

generalov commented Nov 1, 2020

I've modified the extension locally by adding connect-src: https:; to the CSP directive and preview works fine for me. (Extensions: Open extension folder, change 42crunch.vscode-openapi-3.7.0/out/preview.js near the bottom).

Source code:

<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src ${webview.cspSource} https: data:; script-src ${webview.cspSource}; style-src 'unsafe-inline';">

vfateev added a commit that referenced this issue Nov 5, 2020
vfateev added a commit that referenced this issue Nov 5, 2020
Swagger UI Try out not working #80
@vfateev
Copy link
Collaborator

vfateev commented Nov 5, 2020

Fixed

@vfateev vfateev closed this as completed Nov 5, 2020
ak1394 pushed a commit that referenced this issue Jan 24, 2022
ak1394 pushed a commit that referenced this issue Jan 24, 2022
Swagger UI Try out not working #80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants