Inbox proper response code for follow request
This commit is contained in:
parent
933a228072
commit
b7ac51a967
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user