Skip to content

Commit

Permalink
Update HTTP header name in wp-404-caching plugin
Browse files Browse the repository at this point in the history
The HTTP header name 'X-WP_404_Caching-404-Cache' has been updated to 'X-WP-404-Cache' in class-full-page-cache-404 and all its instances within the project. Similarly, the unit tests have been updated to reflect these changes ensuring consistency in the caching system.
  • Loading branch information
attackant committed Mar 11, 2024
1 parent 9743f47 commit cd729d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/features/class-full-page-cache-404.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static function get_cached_response_with_headers(): string {
}

/**
* Send X-WP_404_Caching HTTP Header.
* Send X-WP-404-Cache HTTP Header.
*
* @param string $type HIT or MISS.
* @param bool $stale Whether the stale cache is in use. Default false.
Expand All @@ -176,11 +176,11 @@ public static function send_header( string $type, bool $stale = false ): void {
}

if ( ! $stale && 'HIT' === $type ) {
header( 'X-WP_404_Caching-404-Cache: HIT' );
header( 'X-WP-404-Cache: HIT' );
} elseif ( $stale && 'HIT' === $type ) {
header( 'X-WP_404_Caching-404-Cache: HIT (stale)' );
header( 'X-WP-404-Cache: HIT (stale)' );
} elseif ( 'MISS' === $type ) {
header( 'X-WP_404_Caching-404-Cache: MISS' );
header( 'X-WP-404-Cache: MISS' );
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/FullPageCache404Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @link https://mantle.alley.com/testing/test-framework.html
*/
class Test_Full_Page_Cache_404 extends TestCase {
final class FullPageCache404Test extends TestCase {
use Refresh_Database;
use Admin_Screen;

Expand Down Expand Up @@ -215,7 +215,7 @@ public function test_full_page_cache_not_returned_for_non_404(): void {
$post_id = self::factory()->post->create( [ 'post_title' => 'Hello World' ] );
$response = $this->get( get_the_permalink( $post_id ) );
$response->assertStatus( 200 );
$response->assertHeaderMissing( 'X-Alleyvate-404-Cache' );
$response->assertHeaderMissing( 'X-WP-404-Cache' );
$response->assertSee( 'Hello World' );

$this->assertFalse(
Expand Down

0 comments on commit cd729d6

Please sign in to comment.