Changeset 60635
- Timestamp:
- 08/14/2025 09:14:18 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/rest-api/class-wp-rest-server.php (modified) (2 diffs)
-
tests/phpunit/tests/rest-api/rest-server.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r60177 r60635 1748 1748 1749 1749 foreach ( $requests as $single_request ) { 1750 if ( is_wp_error( $single_request ) ) { 1751 $has_error = true; 1752 $validation[] = $single_request; 1753 continue; 1754 } 1755 1750 1756 $match = $this->match_request_to_handler( $single_request ); 1751 1757 $matches[] = $match; … … 1818 1824 1819 1825 foreach ( $requests as $i => $single_request ) { 1826 if ( is_wp_error( $single_request ) ) { 1827 $result = $this->error_to_response( $single_request ); 1828 $responses[] = $this->envelope_response( $result, false )->get_data(); 1829 continue; 1830 } 1831 1820 1832 $clean_request = clone $single_request; 1821 1833 $clean_request->set_url_params( array() ); -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r60251 r60635 2331 2331 2332 2332 /** 2333 * @ticket 63502 2334 */ 2335 public function test_batch_request_with_malformed_url() { 2336 $request = new WP_REST_Request( 'POST', '/batch/v1' ); 2337 $request->set_header( 'Content-Type', 'application/json' ); 2338 $request->set_body_params( 2339 array( 2340 'requests' => array( 2341 array( 2342 'method' => 'POST', 2343 'path' => 'http://user@:80', 2344 ), 2345 ), 2346 ) 2347 ); 2348 2349 $response = rest_get_server()->dispatch( $request ); 2350 $data = $response->get_data()['responses'][0]['body'] ?? null; 2351 2352 $this->assertIsArray( $data ); 2353 $this->assertSame( 'parse_path_failed', $data['code'] ); 2354 } 2355 2356 /** 2333 2357 * @ticket 51020 2334 2358 */
Note: See TracChangeset
for help on using the changeset viewer.