-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add response decoding using Decodable #113
Conversation
a620f06
to
ea32026
Compare
There seems to be a flaky test that fails eventually when I run them locally:
Most of the attempts succeed, though. An identical Travis job on my fork also passed. |
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.
@guilhermearaujo Thanks for the PR! Left one comment, other than that looks great.
|
||
public extension Promise where T: Response { | ||
@available(swift 4.1) | ||
func decode<U: Decodable>( |
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.
How about:
fun decode<U: Decodable>(_ type: U.Type, using decoder: JSONDecoder = JSONDecoder()) {
// ...
}
Then you can pass your custom decoder configured with data and date decoding strategy if needed.
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.
That's a good idea, I'll change it.
That flaky test can be fixed in a separate PR I think. |
ea32026
to
56e8133
Compare
56e8133
to
fdea449
Compare
Codecov Report
@@ Coverage Diff @@
## master #113 +/- ##
==========================================
+ Coverage 92.58% 92.73% +0.15%
==========================================
Files 62 64 +2
Lines 3046 3110 +64
==========================================
+ Hits 2820 2884 +64
Misses 226 226
Continue to review full report at Codecov.
|
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.
Awesome. Thanks @guilhermearaujo 👏
As requested on #93