Comments (8)
Hi @hateCarrot,
have you tried the following?
headers={{"Authorization":"ApiKey api_key=blah blah"}}
from react-http-request.
hi @mbasso
I changed it to the way you told me. Then the error message was changed.
"XMLHttpRequest cannot load http://konanlink-test.elasticbeanstalk.com/v1/device/list.json. Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response."
The above address is normally returned when running as postman. So it does not seem to be a server problem. Do I have something more to do? Thank you for your reply.
from react-http-request.
and Here is request code.
<Request
url='http://konanlink-test.elasticbeanstalk.com/v1/device/list.json'
method='post'
type='application/x-www-form-urlencoded'
accept='application/json'
headers={{"Authorization":"ApiKey api_key=blah blah"}}
verbose={true}
send='{"offset":"0","limit":"100"}'
>
{
({error, result, loading}) => {
if (loading) {
return <div>loading...</div>;
} else {
return <div>{ JSON.stringify(result) }</div>;
}
}
}
</Request>
from react-http-request.
Unfortunately it seems to be a server problem.
Postman works fine because is a chrome extension and has more privileges than regular web pages (check this for more information).
However, to make your site work, you have to enable CORS.
Here you can find a simple explanation of the problem is and here is an example of the headers that you have to add to the reponse.
from react-http-request.
Thanks a lot @mbasso
I'll try to solve the problem as you told me.
Merry Christmas and Happy new year :)
from react-http-request.
Thanks, you too :) 🎄 🎅
Did you solve the problem with CORS?
from react-http-request.
@hateCarrot Can I close this issue?
from react-http-request.
I'm sorry I was late. Thank you for your great help. Close this issue.
Merry Christmas & Happy new year :)
from react-http-request.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-http-request.