From 69e680d31867d69ccdfac4bd9b733806443e29a1 Mon Sep 17 00:00:00 2001 From: Louis-Michel Couture Date: Wed, 10 May 2023 16:27:04 -0400 Subject: [PATCH] Accept 204 No Content as a valid success status When proxying requests through a backend, the backend might return 204 No Content to indicate the request was processed but there's nothing to return. Consider this response successful. --- src/mixpanel-core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixpanel-core.js b/src/mixpanel-core.js index e6e00759..b924f3b7 100644 --- a/src/mixpanel-core.js +++ b/src/mixpanel-core.js @@ -516,7 +516,7 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) { req.withCredentials = true; req.onreadystatechange = function () { if (req.readyState === 4) { // XMLHttpRequest.DONE == 4, except in safari 4 - if (req.status === 200) { + if (req.status === 200 || req.status === 204) { if (callback) { if (verbose_mode) { var response;