-
-
Notifications
You must be signed in to change notification settings - Fork 206
fix: the Response from DioError could return null from the data property but String is expected in ParseNetworkResponse #775
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
Conversation
Thanks for opening this pull request!
|
Could you please replace the PR title with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test for this?
I will reformat the title to use the proper commit message syntax. |
Sure, but I can not find a way to mock the
so I can create a mock for it and inject it in the constructor of
But this requires the 'nonfunction-type-aliases' language feature to be enabled, so we need to set the minimum SDK constraint to Do you have any suitable way to do this? |
Codecov ReportBase: 10.26% // Head: 10.08% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #775 +/- ##
==========================================
- Coverage 10.26% 10.08% -0.19%
==========================================
Files 49 47 -2
Lines 2815 2817 +2
==========================================
- Hits 289 284 -5
- Misses 2526 2533 +7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@parse-community/flutter-sdk-review what do you think, is this ready for merge? |
…the values as String when decoding it.
@Nidal-Bakir any particular reason for closing this? |
@parse-community/flutter-sdk-review should this PR be merged? |
@mtrezza I was testing some things in my forked repository so I got to a point where I just needed to start from the beginning. so found it easier to just delete the repository and start all over again. |
I've reopened, thanks for clarifying |
@@ -31,7 +31,9 @@ class ParseDioClient extends ParseClient { | |||
data: dioResponse.data!, statusCode: dioResponse.statusCode!); | |||
} on dio.DioError catch (error) { | |||
return ParseNetworkResponse( | |||
data: error.response?.data, statusCode: error.response!.statusCode!); | |||
data: error.response?.data ?? _fallbackErrorData, | |||
statusCode: error.response!.statusCode!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran this code without internet connection and got null error in statusCode!
I suggest you change the code like this
return ParseNetworkResponse(
data: error.response?.data ?? _fallbackErrorData,
statusCode: error.response?.statusCode! ?? ParseError.otherCause,
);
Reopening in a different PR because I lost all the progress and the reference of these changes. |
New Pull Request Checklist
Issue Description
The response from
dio
error object could have a nulldata
propertyRelated issue: #774
Approach
Add null aware operator
??
:TODOs before merging
All set