add actions pre running the http GET/POST requests
/cc @mattwiebe
This commit is contained in:
parent
338c63d3e1
commit
3c0ee1aeba
1 changed files with 4 additions and 0 deletions
|
@ -20,6 +20,8 @@ class Http {
|
|||
* @return array|WP_Error The POST Response or an WP_ERROR
|
||||
*/
|
||||
public static function post( $url, $body, $user_id ) {
|
||||
do_action( 'activitypub_pre_http_post', $url, $body, $user_id );
|
||||
|
||||
$date = \gmdate( 'D, d M Y H:i:s T' );
|
||||
$digest = Signature::generate_digest( $body );
|
||||
$signature = Signature::generate_signature( $user_id, 'post', $url, $date, $digest );
|
||||
|
@ -68,6 +70,8 @@ class Http {
|
|||
* @return array|WP_Error The GET Response or an WP_ERROR
|
||||
*/
|
||||
public static function get( $url ) {
|
||||
do_action( 'activitypub_pre_http_get', $url );
|
||||
|
||||
$date = \gmdate( 'D, d M Y H:i:s T' );
|
||||
$signature = Signature::generate_signature( Users::APPLICATION_USER_ID, 'get', $url, $date );
|
||||
|
||||
|
|
Loading…
Reference in a new issue