- Timestamp:
- 10/27/2020 04:42:38 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-request.php
r48945 r49329 325 325 326 326 /** 327 * Checks if the request has specified a JSON content-type. 328 * 329 * @since 5.6.0 330 * 331 * @return bool True if the content-type header is JSON. 332 */ 333 public function is_json_content_type() { 334 $content_type = $this->get_content_type(); 335 336 return isset( $content_type['value'] ) && wp_is_json_media_type( $content_type['value'] ); 337 } 338 339 /** 327 340 * Retrieves the parameter priority order. 328 341 * … … 336 349 $order = array(); 337 350 338 $content_type = $this->get_content_type(); 339 if ( isset( $content_type['value'] ) && 'application/json' === $content_type['value'] ) { 351 if ( $this->is_json_content_type() ) { 340 352 $order[] = 'JSON'; 341 353 } … … 659 671 660 672 // Check that we actually got JSON. 661 $content_type = $this->get_content_type(); 662 663 if ( empty( $content_type ) || 'application/json' !== $content_type['value'] ) { 673 if ( ! $this->is_json_content_type() ) { 664 674 return true; 665 675 }
Note: See TracChangeset
for help on using the changeset viewer.