Skip to content

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

Merged
jsnajdr merged 1 commit into
trunkfrom
remove/batch-spec-block-patterns-rest
Mar 29, 2022
Merged

Remove batch support declaration from block patterns REST, fix navigation areas#39834
jsnajdr merged 1 commit into
trunkfrom
remove/batch-spec-block-patterns-rest

Conversation

@jsnajdr

@jsnajdr jsnajdr commented Mar 29, 2022

Copy link
Copy Markdown
Member

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.

@ntsekouras ntsekouras left a comment

Copy link
Copy Markdown
Contributor

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