amplitude / Amplitude-Android

Native Android SDK for Amplitude
MIT License
164 stars 90 forks source link

AmplitudeClient.makeEventUploadPostRequest shall check HTTP response 200 rather than matching string response to "success" #348

Closed jackcsk closed 1 year ago

jackcsk commented 1 year ago

Summary

In related to the amplitude-javascript pull request https://github.com/amplitude/Amplitude-JavaScript/pull/572, AmplitudeClient.makeEventUploadPostRequest(client, event, maxEventId, maxIdentifyId) shall match Response.code to 200 rather than doing a string comparison of "success"

Current behavior blocks the usage of custom amplitude proxy, which returns HTTP 200 response in this format:

{"code":200,"status":"SUCCESS","data":true}

Error Message

From logcat:

01-27 19:17:55.455 17721 17910 W com.amplitude.api.AmplitudeClient: Upload failed, {"code":200,"status":"SUCCESS","data":true}
01-27 19:17:55.455 17721 17910 W com.amplitude.api.AmplitudeClient: , will attempt to reupload later