Before using Axios to find each call interface will have two requests, the first request when the option request, and do not see the request parameters, then did not notice, only as a pre-request, to determine whether the interface is smooth, but the recent discovery is not so.
First we know the option request when an extra request is made, so what does this do?
If it is just an ordinary Ajax request, the request will not be initiated and will be initiated automatically only if the AJAX request binds to the upload event and crosses the domain. See HTTP://WWW.TUICOOL.COM/ARTICLES/3UBZIBB in detail.
It is clear that we have upload event bindings (which are usually local debugging, so there will be cross-domain), I looked at the next Axios document, found that the config configuration file has two parameters
// onuploadprogress:function (progressevent) { // //Do whatever your want with the native Progress event // },// ondownloadprogress:function (progressevent) {////Do Whatever want with the native Progress event// },
The upload and download events are handled separately, that is, the upload event is bound here, so there is an option request for each request.
The solution is simple, just comment out, of course, if the development of the project on-line with the requested interface is the same domain name will naturally not two requests. Look at personal needs, about the use of Axios on a Boven introduction http://www.cnblogs.com/Upton/p/6180512.html
Why the Axios request interface will initiate two requests