Thursday, March 16, 2017

Laravel return text/html and not json?

I have this in response headers:

Response headers (165 B)    
    Host    
    "localhost:8000"
    [Learn More]
    Connection  
    "close"
    [Learn More]
    Content-Type    
    "text/html; charset=UTF-8"
    [Learn More]
    Date    
    "Thu, 16 Mar 2017 14:33:53 GMT"
    [Learn More]
    Transfer-Encoding   
    "chunked"

My controller is quite simple:

public function login(Request $request){

      return response()->json([
        'name' => 'Abigail',
        'state' => 'CA'
        ]);
    }

Im using angular for post.



via uzhas

Advertisement