raml-org / api-modeling-framework

DEPRECATED - This project has been moved
https://github.com/aml-org/amf
Other
27 stars 11 forks source link

CORS proxy for parser #44

Open antoniogarrote opened 7 years ago

antoniogarrote commented 7 years ago

There's already a workaround for this.

I'm opening the issue for documentation and as a reminder of that we need a better solution.

Use of a proxy to resolve URL requests in the parsers is supported using a global variable.

window.JS_USE_PROXY = "http:/path.to/$URL"

Once this variable has been declared, requests will be send to the URL in the global variable where$URL is a placeholder for the position of the URL to request. The URL does not need to be URL encoded. The library will take care of URL encoding it.

See this commit for more information: bb60502fa61b4667cf95a9ca0b115c14c0f56d5e

Also check this commit in the AMF-playground to see how it can be enabled:

https://github.com/mulesoft-labs/amf-playground/commit/88bc420a9c4b672b1956083fc9a328b722c5638f

postatum commented 7 years ago

Artem Kostiuk @antonio.garrote regarding issues: 44(proxy) - not sure what I have to do about it. Is it just about defining JS_USE_PROXY in amf-playground if needed? 41(parsing error) - we already have a workaround and delay that for after Connect? Antonio Garrote Yes that's all. The variable is already added in the code of amf-playground, but is commented. See the last link in the issue. If you need to modify the request somehow (e.g adding headers) you can do it in the JS_REST function.