more consistent use of response content type (#529)
* more consistent use of response content type * update readme * fix typo
This commit is contained in:
parent
9ac5d84f5c
commit
b946ef3de1
9 changed files with 40 additions and 26 deletions
|
@ -114,6 +114,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
|
||||||
* Improved: loading of shortcodes
|
* Improved: loading of shortcodes
|
||||||
* Updated: caching of followers
|
* Updated: caching of followers
|
||||||
* Updated: Application-User is no longer "indexable"
|
* Updated: Application-User is no longer "indexable"
|
||||||
|
* Updated: more consistent usage of the `application/activity+json` Content-Type
|
||||||
|
|
||||||
### 1.0.7 ###
|
### 1.0.7 ###
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,10 @@ class Collection {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new WP_REST_Response( $response, 200 );
|
$rest_response = new WP_REST_Response( $response, 200 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,7 +171,10 @@ class Collection {
|
||||||
$response['orderedItems'][] = Post::transform( $post )->to_object()->to_array();
|
$response['orderedItems'][] = Post::transform( $post )->to_object()->to_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new WP_REST_Response( $response, 200 );
|
$rest_response = new WP_REST_Response( $response, 200 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -192,7 +198,10 @@ class Collection {
|
||||||
$response['orderedItems'][] = $user->get_url();
|
$response['orderedItems'][] = $user->get_url();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new WP_REST_Response( $response, 200 );
|
$rest_response = new WP_REST_Response( $response, 200 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,10 +103,10 @@ class Followers {
|
||||||
$data['followers']
|
$data['followers']
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = new WP_REST_Response( $json, 200 );
|
$rest_response = new WP_REST_Response( $json, 200 );
|
||||||
$response->header( 'Content-Type', 'application/activity+json' );
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
return $response;
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -79,10 +79,10 @@ class Following {
|
||||||
|
|
||||||
$json->first = $json->partOf; // phpcs:ignore
|
$json->first = $json->partOf; // phpcs:ignore
|
||||||
|
|
||||||
$response = new \WP_REST_Response( $json, 200 );
|
$rest_response = new WP_REST_Response( $json, 200 );
|
||||||
$response->header( 'Content-Type', 'application/activity+json' );
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
return $response;
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -109,11 +109,10 @@ class Inbox {
|
||||||
*/
|
*/
|
||||||
\do_action( 'activitypub_inbox_post' );
|
\do_action( 'activitypub_inbox_post' );
|
||||||
|
|
||||||
$response = new WP_REST_Response( $json, 200 );
|
$rest_response = new WP_REST_Response( $json, 200 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
$response->header( 'Content-Type', 'application/activity+json' );
|
return $rest_response;
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +137,10 @@ class Inbox {
|
||||||
\do_action( 'activitypub_inbox', $data, $user->get__id(), $type );
|
\do_action( 'activitypub_inbox', $data, $user->get__id(), $type );
|
||||||
\do_action( "activitypub_inbox_{$type}", $data, $user->get__id() );
|
\do_action( "activitypub_inbox_{$type}", $data, $user->get__id() );
|
||||||
|
|
||||||
return new WP_REST_Response( array(), 202 );
|
$rest_response = new WP_REST_Response( array(), 202 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +185,10 @@ class Inbox {
|
||||||
\do_action( "activitypub_inbox_{$type}", $data, $user->ID );
|
\do_action( "activitypub_inbox_{$type}", $data, $user->ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new WP_REST_Response( array(), 202 );
|
$rest_response = new WP_REST_Response( array(), 202 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -123,11 +123,10 @@ class Outbox {
|
||||||
*/
|
*/
|
||||||
\do_action( 'activitypub_outbox_post' );
|
\do_action( 'activitypub_outbox_post' );
|
||||||
|
|
||||||
$response = new WP_REST_Response( $json, 200 );
|
$rest_response = new WP_REST_Response( $json, 200 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
$response->header( 'Content-Type', 'application/activity+json' );
|
return $rest_response;
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,11 +54,10 @@ class Server {
|
||||||
|
|
||||||
$json = $user->to_array();
|
$json = $user->to_array();
|
||||||
|
|
||||||
$response = new WP_REST_Response( $json, 200 );
|
$rest_response = new WP_REST_Response( $json, 200 );
|
||||||
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
$response->header( 'Content-Type', 'application/activity+json' );
|
return $rest_response;
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,10 +95,10 @@ class Users {
|
||||||
|
|
||||||
$json = $user->to_array();
|
$json = $user->to_array();
|
||||||
|
|
||||||
$response = new WP_REST_Response( $json, 200 );
|
$rest_response = new WP_REST_Response( $json, 200 );
|
||||||
$response->header( 'Content-Type', 'application/activity+json' );
|
$rest_response->header( 'Content-Type', 'application/activity+json; charset=' . get_option( 'blog_charset' ) );
|
||||||
|
|
||||||
return $response;
|
return $rest_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
|
||||||
* Improved: loading of shortcodes
|
* Improved: loading of shortcodes
|
||||||
* Updated: caching of followers
|
* Updated: caching of followers
|
||||||
* Updated: Application-User is no longer "indexable"
|
* Updated: Application-User is no longer "indexable"
|
||||||
|
* Updated: more consistent usage of the `application/activity+json` Content-Type
|
||||||
|
|
||||||
= 1.0.7 =
|
= 1.0.7 =
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue