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

Faulty check for successful article deletion #1206

Open
dlh01 opened this issue Dec 2, 2024 · 0 comments
Open

Faulty check for successful article deletion #1206

dlh01 opened this issue Dec 2, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@dlh01
Copy link
Member

dlh01 commented Dec 2, 2024

Description of the bug

When performing a DELETE request using \Apple_Push_API\Request\Request::request(), the response is considered successful if the $response variable is null:

// NULL is a valid response for DELETE.
if ( 'DELETE' === $verb && is_null( $response ) ) {

However, $response contains the return value from wp_safe_remote_request(), which, as far as I can tell, returns array|WP_Error and never null.

Steps To Reproduce

Perform a DELETE request using the request() method. Using XDebug or a similar debugger, observe that even a successful request does not return at the current check for null.

Additional Information

The Apple News developer documentation says that a successful DELETE request will return a 204 No Content. I wonder whether the current check was written as if $response contained the raw response body, which would indeed be empty on success.

@dlh01 dlh01 added the bug Something isn't working label Dec 2, 2024
@dlh01 dlh01 added this to the 2.7.0 milestone Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant