From f2981650a1bba7bfb5ebdb39110b5cb3c66bdea0 Mon Sep 17 00:00:00 2001 From: Martin Bastien Date: Thu, 8 Dec 2016 11:45:33 -0500 Subject: [PATCH] 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. --- resources/assets/js/bootstrap.js | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/assets/js/bootstrap.js b/resources/assets/js/bootstrap.js index 70d4728e..eb05c217 100644 --- a/resources/assets/js/bootstrap.js +++ b/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