Repository navigation
fix(newsletter): send the signup request as JSON - #561
Open
enricobattocchi wants to merge 1 commit into
Open
enricobattocchi wants to merge 1 commit into
enricobattocchi wants to merge 1 commit into
Conversation
The my.yoast.com subscribe endpoint only reads JSON bodies, so the form-encoded request was always rejected with a 400. A 200 reply was also treated as a failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
enricobattocchi
force-pushed
the
fix-newsletter-signup
branch
from
October 8, 2026 12:42
8a536d3 to
75ae37d
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new tests lack a required wp_unslash() stub and fail before exercising the subscription logic.
1 open finding
What changed in this PR
Fixes newsletter signup in the Duplicate Post admin notice by matching the endpoint’s JSON request format.
Changes:
- Encodes subscription data as JSON with the appropriate content type.
- Accepts all HTTP 200–299 responses as successful.
- Adds regression tests for request formatting and response handling.
| File | Description |
|---|---|
| tests/Unit/UI/Newsletter_Test.php | Adds request and response regression tests. |
| src/ui/newsletter.php | Sends JSON and accepts the full success range. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Coverage Report for CI Build 37778855070Coverage increased (+2.4%) to 65.24%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
wp_json_encode()and sent with aContent-Type: application/jsonheader, matching how Yoast SEO calls the same endpoint.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
test@, and check that the form shows an error message.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Documentation
Quality assurance
Innovation
innovationlabel and noted the work hours.Fixes #
🤖 Generated with Claude Code