Giter VIP home page Giter VIP logo

Comments (8)

mbasso avatar mbasso commented on May 12, 2024

Hi @hateCarrot,
have you tried the following?
headers={{"Authorization":"ApiKey api_key=blah blah"}}

from react-http-request.

hateCarrot avatar hateCarrot commented on May 12, 2024

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.

hateCarrot avatar hateCarrot commented on May 12, 2024

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.

mbasso avatar mbasso commented on May 12, 2024

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.

hateCarrot avatar hateCarrot commented on May 12, 2024

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.

mbasso avatar mbasso commented on May 12, 2024

Thanks, you too :) 🎄 🎅
Did you solve the problem with CORS?

from react-http-request.

mbasso avatar mbasso commented on May 12, 2024

@hateCarrot Can I close this issue?

from react-http-request.

hateCarrot avatar hateCarrot commented on May 12, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.