dropbox / dropbox/dropbox-sdk-js
CORS preflights on every call
- Dominant language
- JavaScript
- Stars
- 970
- Forks
- 353
- Avg merge
- 9h 3m
- Merged PRs (30d)
- 2
Description
It looks like every call the SDK makes requires a CORS preflight - very inefficient.
On [this page](https://www.hitchhq.com/dropbox/activities/57b2d630a43e3fb71ba61758)
I found this:
Browser-based JavaScript and CORS pre-flight requests
When browser-based JavaScript code makes a cross-site HTTP request, the browser must sometimes send a "pre-flight" check to make sure the server allows cross-site requests. You can avoid the extra round-trip by ensuring your request meets the CORS definition of a "simple cross-site request".
•·Use URL parameters arg and authorization instead of HTTP headers Dropbox-API-Arg and Authorization.
•·Set the Content-Type to "text/plain; charset=dropbox-cors-hack" instead of "application/json" or "application/octet-stream".
•·Always set the URL parameter reject_cors_preflight=true. This makes it easier to catch cases where your code is unintentionally triggering a pre-flight check.
I hop the above helps.
Contributor guide
Assessment
This issue has not been assessed yet.