Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/e2e-tests/mu-plugins/nocache-headers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* Plugin Name: Gutenberg Test Plugin, No-cache Headers
* Plugin URI: https://github.com/WordPress/gutenberg
* Author: Gutenberg Team
*
* @package gutenberg-test-nocache-headers
*/

// Remove 'no-store' from the Cache-Control header set by WordPress when running
// E2E tests. This is a workaround for an issue where E2E tests time out waiting
// for 'networkidle'.
add_filter(
'nocache_headers',
static function( $headers ) {
$cache_control_parts = explode( ', ', $headers['Cache-Control'] );
$cache_control_parts = array_diff( $cache_control_parts, array( 'no-store' ) );
$headers['Cache-Control'] = implode( ', ', $cache_control_parts );
return $headers;
}
);