rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

"Try" functionality response handling issues #137

Closed shaigluskin closed 4 years ago

shaigluskin commented 4 years ago

In one case on RapiDoc I see Response Status: NetworkError when attempting to fetch resource. (CORS or Network Issue) but when I copy the curl script from the curl tab and run it on my terminal the endpoint returned "status No Data found, count 0."

In another case where RapiDoc showed Response Status: NetworkError when attempting to fetch resource. (CORS or Network Issue) I pasted the curl from the curl tab into my terminal and the response was, {"status":"Error","message":"field1, field2 or field3 must be provided"}

Is something amiss in my spec? Or is this a feature request to print more detail from incoming messaging from target? Something else?

Thanks again for the great work. It's so cool.

mrin9 commented 4 years ago

most likely its coz, when ajax calls are made through browser it is treated as a separate origin (web-site) therefore the API server must allow cross-origin request for the API calls to be successful. curl on the other hand dont have this limitation as it is not executed on a web server

https://www.reddit.com/r/webdev/comments/6fmpjq/cors_browser_vs_curl/