-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Issue found when installing 'request' package #495
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
Comments
What is your use case for |
I want to consume an external server api (not a localhost one, but on another external domain). |
fetch() works with any domain as long as CORS is configured on it. |
Hello @gaearon, In summary: I am setting the proxy url to: You may see the code in my react-date-range repo, use-fetch branch. |
You don’t need to. Why did you do this? We don’t treat URLs starting with So it tried to load |
Verified that this fixes the problem in your repo: function search(query) {
- return fetch(`/api/holidays?${query}`, {
+ return fetch(`/holidays?${query}`, {
accept: 'application/json',
}).then(checkStatus)
.then(parseJSON);
@@ -129,7 +129,7 @@ class Form extends Component {
return response.json();
}
- search(querystring);
+ search(querystring).then(result => console.log(result));
}
|
You are right indeed! Thank you heaps for the given code correction. Now it all works as expected! |
I installed require npm package on app, imported it in react module, and got this error:
Is a very similar issue to what's described here:
request/request#1691
In the issue above is indicated to tweak the webpack.config.js file to cater for those elements that are being called.
Is there any known workaround for this?
The text was updated successfully, but these errors were encountered: