diff --git a/ActivityPubPlugin.php b/ActivityPubPlugin.php index b26e6c5..42b43c2 100755 --- a/ActivityPubPlugin.php +++ b/ActivityPubPlugin.php @@ -871,8 +871,9 @@ class ActivityPubReturn * @param array $res * @return void */ - public static function answer($res) + public static function answer($res, $code = 200) { + http_response_code($code); header('Content-Type: application/activity+json'); echo json_encode($res, JSON_UNESCAPED_SLASHES | (isset($_GET["pretty"]) ? JSON_PRETTY_PRINT : null)); exit; diff --git a/actions/inbox/Follow.php b/actions/inbox/Follow.php index cc57bd6..e0f12e0 100755 --- a/actions/inbox/Follow.php +++ b/actions/inbox/Follow.php @@ -45,7 +45,7 @@ try { try { if (!Subscription::exists($actor_profile, $object_profile)) { Subscription::start($actor_profile, $object_profile); - ActivityPubReturn::answer(Activitypub_accept::accept_to_array(Activitypub_follow::follow_to_array($data->actor, $data->object))); + ActivityPubReturn::answer(Activitypub_accept::accept_to_array(Activitypub_follow::follow_to_array($data->actor, $data->object)), 202); } else { ActivityPubReturn::error("Already following.", 409); }