Browse Source

Make axios compatible with Request::ajax()

It seems the library doesn't send the `X-Requested-With: XMLHttpRequest` header by default, if it's not present `$request->ajax()` always returns false.
Martin Bastien 8 years ago
parent
commit
f2981650a1
1 changed files with 1 additions and 0 deletions
  1. 1 0
      resources/assets/js/bootstrap.js

+ 1 - 0
resources/assets/js/bootstrap.js

@@ -25,6 +25,7 @@ window.Vue = require('vue');
  */
 
 window.axios = require('axios');
+window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
 
 /**
  * Echo exposes an expressive API for subscribing to channels and listening