Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_API_Server::is_json_request()
Check if the current request accepts a JSON response by checking the endpoint suffix (.json) or the HTTP ACCEPT header
Description Description
Return Return
(bool)
Source Source
File: includes/legacy/api/v1/class-wc-api-server.php
private function is_json_request() { // check path if ( false !== stripos( $this->path, '.json' ) ) { return true; } // check ACCEPT header, only 'application/json' is acceptable, see RFC 4627 if ( isset( $this->headers['ACCEPT'] ) && 'application/json' == $this->headers['ACCEPT'] ) { return true; } return false; }
Changelog Changelog
Version | Description |
---|---|
2.1 | Introduced. |