0

my api controller:

$POST /api/member/logout

public function post_logout(){
    try{
        member::logout();
        return Response::json([], 200);
    }catch(Exception $e){
        print_r($e);
        return Response::json($e, 500);
    }
}

and my model

public static function logout(){
    if(!Auth::check()){
        throw new Exception('not_logged');
    }

    Auth::logout();
}

It is returning status 200 but never ends loading (18.3mb loaded and counting...)

1 Answer 1

3

You are printing Exception object before json response with status 500, so PHP automatically sends response with status code 200.

As for huge never-ending response, I'm not sure since I don't know Laravael at all, but I suspect, that somewhere you are (or this framework is) dumping an object that references itself.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.