arjun-g / vs-swagger-viewer

Swagger Viewer lets you preview and validate Swagger 2.0 and OpenAPI files as you type in Visual Studio Code.
MIT License
170 stars 47 forks source link

Is it possible to avoid CORS restriction on the viewer? #30

Open dellagustin opened 6 years ago

dellagustin commented 6 years ago

I'm trying to perform GET request from the editor being shown by the viewer. The resource is at https://gpodder.net/clientconfig.json

When I perform the GET request the editor show the error TypeError: Failed to fetch.

I believe this is a CORS restriction that is being applied because when I access http://localhost:9000 in chrome I get the same error and inspecting the console I see:

Failed to load https://gpodder.net/clientconfig.json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

but when I try it again on chrome with the option "--disable-web-security", where the CORS check does not apply, the request is successful.

Would it be possible to disable web security in the viewer as an option?