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

Allow POST requests in endpoint for ServerSideRender block component #196

Closed
wants to merge 5 commits into from

Conversation

kienstra
Copy link

This allows a block's <ServerSideRender> component to make a POST request, in case the attributes are too big for a GET request.

There have been several cases where sending the attributes in the GET request URL causes an error:

WordPress/gutenberg#19935
WordPress/gutenberg#16396 (comment)
https://wordpress.org/support/topic/error-loading-block-the-response-is-not-a-valid-json-response-2/

This follows the suggestion in 2 of those issues to allow using POST for the block endpoint, in addition to GET.

Trac ticket: https://core.trac.wordpress.org/ticket/49680


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

In order to allow <ServerSideRender> components
to have a large attributes object,
ideally it could POST attributes instead of
making a GET request for them.
So add support for a POST request in this endpoint that
<ServerSideRender> uses.
Following the convention
of other test methods.
@kienstra
Copy link
Author

It doesn't look like the Travis failures are related to this PR, though maybe I missed something.

@kienstra
Copy link
Author

kienstra commented Mar 23, 2020

WordPress/gutenberg#21068 is what actually uses this PR's addition of POST to the allowed request types.

Instead of having attributes be the entire body,
they are now simply a property of the body.
The test didn't fail locally,
so this might not work.
@TimothyBJacobs
Copy link
Member

Merged in r47756, 5460e0d.

@kienstra
Copy link
Author

kienstra commented May 3, 2020

Nice, thanks so much!

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.

3 participants