Laravel returning a leading \n character on responses -


every response laravel application seems getting prepend \n character, when return number.

it feels have have introduced bug, can't find anywhere might have done that. see have other applications i've built in laravel have (but others don't) after pulling hair out thought i'd check , see if others have experienced.

the issue i'm trying return id , use has leading character. strip client side, rather fix root issue.

eta: route:

route::get('/test', function(){     return 'hello world'; }); 

produces response:

screen shot line

it's not issue html of course, when try assign id, i'm getting "\n 234".

if you're using laravel api, recommend using json response function:

return response()->json([     'id' => 234 ]); 

this should alleviate leading line-break issue.

as why you're experiencing currently, might have request headers. in past, i've had add 'accept' => 'application/json' request headers in order ensure laravel knows want json back.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -