-
Notifications
You must be signed in to change notification settings - Fork 94
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
Allow CORS mode to be optional #60
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ const responseHandler = (res) => | |
}); | ||
|
||
export default class Webflow { | ||
constructor({ endpoint = DEFAULT_ENDPOINT, token, version = "1.0.0" } = {}) { | ||
constructor({ endpoint = DEFAULT_ENDPOINT, token, version = "1.0.0", fetchOpts = {} } = {}) { | ||
if (!token) throw buildRequiredArgError("token"); | ||
|
||
this.responseWrapper = new ResponseWrapper(this); | ||
|
@@ -76,6 +76,7 @@ export default class Webflow { | |
method, | ||
headers: this.headers, | ||
mode: "cors", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. left over from the original PR |
||
...fetchOpts, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing about this approach is it would override the headers (including auth) if someone added a header entry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm. Could change the order:
I think this would do the trick. Thoughts? |
||
}; | ||
|
||
if (data) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is left over as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a leftover. This is how you would accomplish the removal of
cors
mode with the fetch options override approach you suggested instead of theuseCors: false
approach from the first pass.