Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API: Use batch endpoint included in Core #32174

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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