Search code examples
phplaravellumen

Lumen api include html error in every response


I have a lumen app (version 5.7.8) that when i call some route locally it returns the correct response but after that it includes the html error in the response text.

For example, i have this controller with a simple test method which return just a string:

<?php
namespace App\Http\Controllers\Testing;

class PabloController{
    public function test(){
        return 'something';
    }
}

This is the route in web.php:

<?php
$router->post('/test', 'Testing\PabloController@test');

And there you can see the response in postman which include the string response and the html from the error template (/resources/views/Errors/general.blade.php):

enter image description here

Any idea?


Solution

  • Try return it as:

            return response([
                  'success' => true,
                  'data' => 'something'
                ], 200);