auth0-blog / vue-jwt-authentication

MIT License
509 stars 112 forks source link

Why there are duplicate api calls? #6

Closed xueenda closed 8 years ago

xueenda commented 8 years ago

I noticed for every api call there is a method "options" call first and then is the real api call. Why is that? How can I just make one "get" or "post" call?

random-quote OPTIONS 204 xhr build.js:15 258 B 5 ms
random-quote GET 200 xhr Other 292 B 5 ms
users/ OPTIONS 204 xhr build.js:15 272 B 5 ms
users/ POST 201 xhr Other 423 B 39 ms create/ OPTIONS 204 xhr build.js:15 272 B 4 ms
create/ POST 201 xhr Other 423 B 9 ms

GeorgeYan commented 8 years ago

Hey ~ I have a twice http request too, how to fix?

xueenda commented 8 years ago

You don't have to fix. That's the behaviour of cross origin http request.

On Sat, Apr 9, 2016 at 1:22 PM, GeorgeYan notifications@github.com wrote:

Hey ~ I have a twice http request too, how to fix?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/auth0-blog/vue-jwt-authentication/issues/6#issuecomment-207819375

GeorgeYan commented 8 years ago

@xueenda Got it , Thanks for you reply~ :D

rcadhikari commented 7 years ago

When performing certain types of cross-domain Ajax requests, modern browsers that support CORS will insert an extra "preflight" request to determine whether they have permission to perform the action (reference)