mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 07:22:01 +01:00
REST API: Core typically sends nocache headers on all auth'ed responses, as in wp
, admin-ajax
, etc. Because the REST API infrastructure is hooked in pre-wp, we should be setting this ourselves.
Adds unit tests. Props joehoyle. Fixes #34832. Built from https://develop.svn.wordpress.org/trunk@35773 git-svn-id: http://core.svn.wordpress.org/trunk@35737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
43d1ab4720
commit
4ae83ec7ec
@ -236,6 +236,20 @@ class WP_REST_Server {
|
||||
$this->send_header( 'Access-Control-Expose-Headers', 'X-WP-Total, X-WP-TotalPages' );
|
||||
$this->send_header( 'Access-Control-Allow-Headers', 'Authorization' );
|
||||
|
||||
/**
|
||||
* Send nocache headers on authenticated requests.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param bool $rest_send_nocache_headers Whether to send no-cache headers.
|
||||
*/
|
||||
$send_no_cache_headers = apply_filters( 'rest_send_nocache_headers', is_user_logged_in() );
|
||||
if ( $send_no_cache_headers ) {
|
||||
foreach ( wp_get_nocache_headers() as $header => $header_value ) {
|
||||
$this->send_header( $header, $header_value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter whether the REST API is enabled.
|
||||
*
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-RC1-35772';
|
||||
$wp_version = '4.4-RC1-35773';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user