mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
REST API: Match REST API routes on namespace before performing regex checks.
Rule out groups of API endpoints by simple namespace string comparison to reduce the number of regex checks necessary when matching a route. Props TimothyBlynJacobs. Fixes #48530. git-svn-id: https://develop.svn.wordpress.org/trunk@47260 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1431,6 +1431,17 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 48530
|
||||
*/
|
||||
public function test_get_routes_respects_namespace_parameter() {
|
||||
$routes = rest_get_server()->get_routes( 'oembed/1.0' );
|
||||
|
||||
foreach ( $routes as $route => $handlers ) {
|
||||
$this->assertStringStartsWith( '/oembed/1.0', $route );
|
||||
}
|
||||
}
|
||||
|
||||
public function _validate_as_integer_123( $value, $request, $key ) {
|
||||
if ( ! is_int( $value ) ) {
|
||||
return new WP_Error( 'some-error', 'This is not valid!' );
|
||||
|
||||
Reference in New Issue
Block a user