Axios: Axios sends an OPTIONS (http code-204) request before/ after every get request.

Created on 21 May 2017  路  1Comment  路  Source: axios/axios

Summary

Hi I am using axios with react, and I am facing a strange issue. After every get request, the axios library makes a 204 request. Is it supposed to be this way, or am I doing something incorrectly ? Here is the required stack trace from the backend.

> [email protected] start /Users/Yogesh/Projects/Droidsize/Projectwise/server
> node server.js

App is running
OPTIONS /api/profile 204 5.096 ms - -
GET /api/profile 401 28.648 ms - -
OPTIONS /api/projects 204 0.806 ms - -
GET /api/projects 200 54.032 ms - 2810
OPTIONS /api/projects 204 0.749 ms - -
GET /api/projects 304 12.336 ms - -
OPTIONS /api/projects 204 0.582 ms - -
GET /api/projects 304 8.735 ms - -
OPTIONS /api/projects 204 0.147 ms - -
GET /api/projects 304 3.802 ms - -
OPTIONS /api/profile 204 0.095 ms - -
GET /api/profile 401 5.123 ms - -
OPTIONS /api/profile 204 0.196 ms - -

And here is the screenshot of the chrome network tab.
image

Context

  • axios version: v0.16.1
  • Environment: node v7.6, chrome 58, OS X El Capitan

Most helpful comment

Axios isn't making those requests, the browser is. Please take a look at CORS.

>All comments

Axios isn't making those requests, the browser is. Please take a look at CORS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghprod picture ghprod  路  3Comments

ghost picture ghost  路  3Comments

tbaustin picture tbaustin  路  3Comments

varmeh picture varmeh  路  3Comments

samayo picture samayo  路  3Comments