-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
NullPointer on iOS when receiving empty Response? #394
Comments
Hey @anox1337, |
Hello @skydoves , in my opinion the response was properly defined. In that call I am expecting ApiResponse<ErrorResponse?> . The Questionmark indicates that the returntype may or may not be filled. What would you suggest I should use to define a response that has an optional body? |
Hey @anox1337, sorry for the delayed response. To be honest, the better API design for the empty body (204) is receiving Unit response, since you will be only handling success or failure, and you can achieve it already by utilizing the |
Hello @skydoves, yes, using as a return type works. Thank you for your kind help 👍 |
Please complete the following information:
Describe the Bug:
NullPointerException gets thrown on iOS but not on Android.
Hello!
I call an Endpoint where I may get an ErrorResponse, but not always. Looks like this:
See the ErrorResponse is optional.
When calling the Endpoint:
It throws the Nullpointer:
What I would expect is that getOrThrow would return a NULL object, signaling me that the Api Call was successful but no Response object was available. This is exactly how it works on Android.
Am I missing something?
Thank you for your help :)
The text was updated successfully, but these errors were encountered: