Skip to content

Commit

Permalink
REST API: Use batch endpoint included in Core (#32174)
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 25, 2021
1 parent ff35666 commit b66a4e6
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 554 deletions.
308 changes: 0 additions & 308 deletions lib/class-wp-rest-batch-controller.php

This file was deleted.

3 changes: 0 additions & 3 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ function gutenberg_is_experiment_enabled( $name ) {
if ( ! class_exists( 'WP_Rest_Customizer_Nonces' ) ) {
require_once __DIR__ . '/class-wp-rest-customizer-nonces.php';
}
if ( ! class_exists( 'WP_REST_Batch_Controller' ) ) {
require_once __DIR__ . '/class-wp-rest-batch-controller.php';
}
if ( ! class_exists( 'WP_REST_Templates_Controller' ) ) {
require_once __DIR__ . '/full-site-editing/class-wp-rest-templates-controller.php';
}
Expand Down
9 changes: 0 additions & 9 deletions lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ function gutenberg_register_sidebars_and_widgets_endpoint() {
}
add_action( 'rest_api_init', 'gutenberg_register_sidebars_and_widgets_endpoint' );

/**
* Registers the Batch REST API routes.
*/
function gutenberg_register_batch_endpoint() {
$batch = new WP_REST_Batch_Controller();
$batch->register_routes();
}
add_action( 'rest_api_init', 'gutenberg_register_batch_endpoint' );

/**
* Registers the Block editor settings REST API routes.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/batch/default-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import apiFetch from '@wordpress/api-fetch';
*/
export default async function defaultProcessor( requests ) {
const batchResponse = await apiFetch( {
path: '/v1/batch',
path: '/batch/v1',
method: 'POST',
data: {
validation: 'require-all-validate',
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/batch/test/default-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe( 'defaultProcessor', () => {
];

const expectedFetchOptions = {
path: '/v1/batch',
path: '/batch/v1',
method: 'POST',
data: {
validation: 'require-all-validate',
Expand Down
Loading

0 comments on commit b66a4e6

Please sign in to comment.