vendredi 7 septembre 2018

Laravel API request prepending "

My Problem 

Simply put, I have two systems that work together, one thats plain html and uses Axios to send requests to my laravel application and the other is the laravel application which is basically just an API for the first application. When I make a request to the laravel api I keep getting data back that is prepended with the <?php" opening tag which is causing all sorts of random problems!

Javascript

axios.post('http://my.app.test/api/authenticate').then((response) => {
    let data = response.data;
        console.log(data);
    });

Laravel - api.php

Route::middleware('api')->group(function(){
    Route::post('/authenticate', function(Request $request){
        return [
            'something',
            'something else'
        ];
    });
});

Result

<?php["something","something else"]

Any insight as to why this is happening will be helpful. If anymore information is needed please ask and ill provide! Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2M7ypZD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire