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

Remove batch support declaration from block patterns REST, fix navigation areas #39834

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

jsnajdr
Copy link
Member

@jsnajdr jsnajdr commented Mar 29, 2022

Followup to #39185 that removes batch support declaration from the block patterns and categories REST endpoints. They both support only GET, and batching is relevant only for write methods like POST.

I'm also fixing batch support declaration for the /wp/v2/block-navigation-areas endpoints (originally added by @anton-vlasenko in #36374). The /block-navigation-areas endpoint is only readable and doesn't need the declaration. But the /block-navigation-areas/{id} endpoint is writable and doesn't declare batch support. So I moved the declaration to the right place.

How to test:
Before this patch, a batch request like:

await wp.apiFetch( {
  path: '/batch/v1',
  method: 'POST',
  data: {
    requests: [ {
      path: '/wp/v2/block-navigation-areas/1'
    } ]
  }
} )

would fail with a rest_batch_not_allowed error. After this patch, it fails with rest_navigation_area_invalid which is better: the batch is performed, and it's the 1 id that's deemed invalid.

Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jsnajdr jsnajdr merged commit 4a6b2d9 into trunk Mar 29, 2022
@jsnajdr jsnajdr deleted the remove/batch-spec-block-patterns-rest branch March 29, 2022 07:57
@github-actions github-actions bot added this to the Gutenberg 13.0 milestone Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants