I'm trying to check if a username is available for registering by doing async validation with AngularJS on the client side and PHP on the server side.
So I do something simple like this to check if the user exists:
$user = User::find_by('username', $_GET['username']);
if ($user) {
header("HTTP/1.1 200 OK");
}
else {
header("HTTP/1.1 404 Not Found");
}
and I try to return some status codes if it finds the user or not.
But when I try to use something like postman to send GET requests the returning status code is always 200. It doesn't look like I'm able to send different status codes at all.