Avoid treating HTTP 301 and 302 Codes as Failures
As per: https://github.com/woocommerce/woocommerce/issues/21490 Change the definition of a Webhook Delivery Failure to exclude HTTP/301 and HTTP/302 responses. This allows webhook handlers (such as Google Apps Script) to avoid breaching failure limits and disabling webhooks.
This commit is contained in:
parent
8d1daeeaf9
commit
b0b2b34884
|
@ -442,7 +442,8 @@ class WC_Webhook extends WC_Legacy_Webhook {
|
|||
);
|
||||
|
||||
// Track failures.
|
||||
if ( intval( $response_code ) >= 200 && intval( $response_code ) < 300 ) {
|
||||
// Check for a success, which is a 2xx, 301 or 302 Response Code
|
||||
if ( intval( $response_code ) >= 200 && intval( $response_code ) < 303 ) {
|
||||
$this->set_failure_count( 0 );
|
||||
$this->save();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue