Changeset 51648
- Timestamp:
- 08/20/2021 11:43:21 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r51278 r51648 2819 2819 } 2820 2820 2821 $path = untrailingslashit( $path ); 2822 if ( empty( $path ) ) { 2823 $path = '/'; 2824 } 2825 2821 2826 $path_parts = parse_url( $path ); 2822 2827 if ( false === $path_parts ) { -
trunk/tests/phpunit/tests/rest-api.php
r51568 r51648 950 950 951 951 $this->assertSame( array_keys( $preload_data ), array( '/wp/v2/types', 'OPTIONS' ) ); 952 $this->assertArrayHasKey( '/wp/v2/media', $preload_data['OPTIONS'] ); 953 954 $GLOBALS['wp_rest_server'] = $rest_server; 955 } 956 957 /** 958 * @ticket 51636 959 */ 960 function test_rest_preload_api_request_removes_trailing_slashes() { 961 $rest_server = $GLOBALS['wp_rest_server']; 962 $GLOBALS['wp_rest_server'] = null; 963 964 $preload_paths = array( 965 '/wp/v2/types//', 966 array( '/wp/v2/media///', 'OPTIONS' ), 967 '////', 968 ); 969 970 $preload_data = array_reduce( 971 $preload_paths, 972 'rest_preload_api_request', 973 array() 974 ); 975 976 $this->assertSame( array_keys( $preload_data ), array( '/wp/v2/types', 'OPTIONS', '/' ) ); 952 977 $this->assertArrayHasKey( '/wp/v2/media', $preload_data['OPTIONS'] ); 953 978
Note: See TracChangeset
for help on using the changeset viewer.