@@ 437-450 (lines=14) @@ | ||
434 | * |
|
435 | * @return array |
|
436 | */ |
|
437 | public function intercept_refresh_blog_token_request( $response, $args, $url ) { |
|
438 | if ( false === strpos( $url, 'jetpack-refresh-blog-token' ) ) { |
|
439 | return $response; |
|
440 | } |
|
441 | ||
442 | return array( |
|
443 | 'headers' => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), |
|
444 | 'body' => wp_json_encode( array( 'jetpack_secret' => self::BLOG_TOKEN ) ), |
|
445 | 'response' => array( |
|
446 | 'code' => 200, |
|
447 | 'message' => 'OK', |
|
448 | ), |
|
449 | ); |
|
450 | } |
|
451 | ||
452 | /** |
|
453 | * Intercept the `jetpack-refresh-blog-token` API request sent to WP.com, and mock the failure response. |
|
@@ 461-474 (lines=14) @@ | ||
458 | * |
|
459 | * @return array |
|
460 | */ |
|
461 | public function intercept_refresh_blog_token_request_fail( $response, $args, $url ) { |
|
462 | if ( false === strpos( $url, 'jetpack-refresh-blog-token' ) ) { |
|
463 | return $response; |
|
464 | } |
|
465 | ||
466 | return array( |
|
467 | 'headers' => new Requests_Utility_CaseInsensitiveDictionary( array( 'content-type' => 'application/json' ) ), |
|
468 | 'body' => wp_json_encode( array( 'jetpack_secret_missing' => true ) ), // Meaningless body. |
|
469 | 'response' => array( |
|
470 | 'code' => 200, |
|
471 | 'message' => 'OK', |
|
472 | ), |
|
473 | ); |
|
474 | } |
|
475 | ||
476 | /** |
|
477 | * Intercept the `jetpack-token-health` API request sent to WP.com, and mock the "invalid blog token" response. |