Changeset 44172 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 12/14/2018 06:01:24 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43833
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/rest-api.php
r44150 r44172 1343 1343 } 1344 1344 1345 $method = 'GET'; 1346 if ( is_array( $path ) && 2 === count( $path ) ) { 1347 $method = end( $path ); 1348 $path = reset( $path ); 1349 1350 if ( ! in_array( $method, array( 'GET', 'OPTIONS' ), true ) ) { 1351 $method = 'GET'; 1352 } 1353 } 1354 1345 1355 $path_parts = parse_url( $path ); 1346 1356 if ( false === $path_parts ) { … … 1348 1358 } 1349 1359 1350 $request = new WP_REST_Request( 'GET', $path_parts['path'] );1360 $request = new WP_REST_Request( $method, $path_parts['path'] ); 1351 1361 if ( ! empty( $path_parts['query'] ) ) { 1352 1362 parse_str( $path_parts['query'], $query_params ); … … 1367 1377 } 1368 1378 1369 $memo[ $path ] = array( 1370 'body' => $data, 1371 'headers' => $response->headers, 1372 ); 1379 if ( 'OPTIONS' === $method ) { 1380 $response = rest_send_allow_header( $response, $server, $request ); 1381 1382 $memo[ $method ][ $path ] = array( 1383 'body' => $data, 1384 'headers' => $response->headers, 1385 ); 1386 } else { 1387 $memo[ $path ] = array( 1388 'body' => $data, 1389 'headers' => $response->headers, 1390 ); 1391 } 1373 1392 } 1374 1393
Note: See TracChangeset
for help on using the changeset viewer.