V
V
vadik_nv2021-06-30 13:05:22
Vue.js
vadik_nv, 2021-06-30 13:05:22

Axios sends a lot of strange code in the response, why is that?

There is a local educational application. Back: laravel api, front: VueJS
Authentication implemented (only an authenticated user can send a request)
When getting a request from the front, the database receives status 200, but in response I get something strange (like a lot of span tags), instead of a record from the database. I send headers.
Here is the request:

const token = this.state.auth.token
            await axios.get('http://laravel.api/api/tasks', {headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${token}`
            }})

Here's what comes in Response :
<script> Sfdump = window.Sfdump || (function (doc) { var refStyle = doc.createElement('style'), rxEsc = /([.*+?^${}()|\[\]\/\\])/g, idRx = /\bsf-dump-\d+-ref[012]\w+\b/, keyHint = 0 <= navigator.platform.toUpperCase().indexOf('MAC') ? 'Cmd' : 'Ctrl', addEventListener = function (e, n, cb) { e.addEventListener(n, cb, false); }; refStyle.innerHTML = 'pre.sf-dump .sf-dump-compact, .sf-dump-str-collapse .sf-dump-str-collapse, .sf-dump-str-expand .sf-dump-str-expand { display: none; }'; (doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle); refStyle = doc.createElement('style'); (doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle); if (!doc.addEventListener) { addEventListener = function (element, eventName, callback) { element.attachEvent('on' + eventName, function (e) { e.preventDefault = function () {e.returnValue = false;}; e.target = e.srcElement; callback(e); }); }; } function toggle(a, recursive) { var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass; if (/\bsf-dump-compact\b/.test(oldClass)) { arrow = '&#9660;'; newClass = 'sf-dump-expanded'; } else if (/\bsf-dump-expanded\b/.test(oldClass)) { arrow = '&#9654;'; newClass = 'sf-dump-compact'; } else { return false; } if (doc.createEvent && dump-ellipsis-note{color:#1299DA}</style><pre class=sf-dump id=sf-dump-487296104 data-indent-pad="  "><span class=sf-dump-note>Illuminate\Database\Eloquent\Collection</span> {<a class=sf-dump-ref>#1221</a><samp data-depth=1 class=sf-dump-expanded>
  #<span class=sf-dump-protected title="Protected property">items</span>: <span class=sf-dump-note>array:3</span>


this is not the whole response. there are still a lot of similar lines ..
What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question