0

I have a React application which make a call using axios. It does a GET and because of cors configuration, it calls OPTIONS too.

But I have a strange behavior that I didnt't understand at all how this happen. Sometimes, the OPTIONS call seems to return later from the GET response. Both return to me 200.

But how this can possibly happen? Because while OPTIONS does not return a response, how GET could be called? And it seems both are called together.

Im asking this question because I had a bug that only happened when the responses seems to come in this way and I couldn't figure it out what is happening.

Someone could please explain how this dynamic is actually supposed to work?

Thauany Moedano
  • 551
  • 2
  • 8
  • 21
  • Does this answer your question? [Why am I getting an OPTIONS request instead of a GET request?](https://stackoverflow.com/questions/1256593/why-am-i-getting-an-options-request-instead-of-a-get-request) – Bhojendra Rauniyar Jul 27 '20 at 14:44
  • The linked post will help you understand why options request is called. But I don't understand why you get the request sometime after get request? You might be analyzing wrongly. Check that again. The OPTIONS preflight request must be before the get request. Confirm if it is same endpoint. – Bhojendra Rauniyar Jul 27 '20 at 14:45

0 Answers0