400 errors caused by inaccurately returning a success response.
Closed this issue · 2 comments
We are using the ‘io.growthbook.sdk:NetworkDispatcherOkHttp:1.0.0’ and we have seen that when we get an error, for example Invalid API Key:
{
‘status": 400,
‘error": ’Invalid API Key’
}
The response goes to the OnResponse of the GBNetworkDispatcherOkHttp class, it detects that the response was unsuccessful and returns an exception using the ‘onError’. It then goes through the onSuccess and returns that the response was successful when it should not have been, as it was an error. Attached screenshot of why the error occurs.
Also, we have seen that if the app calls a URL that doesn't exist, the app closes returning: ‘FATAL EXCEPTION: OkHttp Dispatcher’. It seems to be because it tries to return the call as successful.
Submitted on behalf of customer
Hello @natasha-growthbook!
Thanks for reporting this issue.
For now the onSuccess
callback is really called when network call is not successful actually.
The pull request was created according to this issue.