mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
REST API: Avoid sending blank Last-Modified headers with authenticated requests.
This commit adds a new `WP_REST_Server#remove_header` method and uses it to clear the `Last-Modified` header when the "no caching" headers are sent (by default for all authenticated REST API requests). This matches the behavior of the `nocache_headers` function used in other parts of WordPress. Previously, the REST API would send an empty `Last-Modified` header in this situation. Under some server and browser configurations, this causes browsers to cache authenticated REST API requests, which is undesirable. Props iv3rson76, zinigor, rmccue, jnylen0. Fixes #40444. git-svn-id: https://develop.svn.wordpress.org/trunk@40805 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -31,6 +31,10 @@ class Spy_REST_Server extends WP_REST_Server {
|
||||
$this->sent_headers[ $header ] = $value;
|
||||
}
|
||||
|
||||
public function remove_header( $header ) {
|
||||
unset( $this->sent_headers[ $header ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the dispatch method so we can get a handle on the request object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user