-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Added missing content type for requestJSONEncodable task #1410
Conversation
SwiftLint found issuesWarnings
Generated by 🚫 Danger |
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.
Totally awesome! Do you think you can add a test to check this as well? Let us know if you don't feel comfortable doing so or if you need some help 👍
@@ -6,6 +6,11 @@ internal extension URLRequest { | |||
do { | |||
let encodable = AnyEncodable(encodable) | |||
httpBody = try JSONEncoder().encode(encodable) | |||
|
|||
if value(forHTTPHeaderField: "Content-Type") == nil { |
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.
Maybe we can add a local constant let contentType = "Content-Type"
here and use that instead of typing it twice? To prevent regressions in the future.
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.
Sounds like a good idea to me. I pushed the change.
Codecov Report
@@ Coverage Diff @@
## master #1410 +/- ##
==========================================
- Coverage 88.41% 86.43% -1.98%
==========================================
Files 5 24 +19
Lines 164 789 +625
==========================================
+ Hits 145 682 +537
- Misses 19 107 +88
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.
Oh, and can you add this change to the Changelog? :)
Changelog and tests are updated. |
I experience the same issue when running tests in version from master, so it doesn't seem like my fault. I guess we either need to increase wait time for this test or rerun tests a couple of times until they pass. |
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.
Thank you very much for this fix, @Vict0rS! 💯
Thanks a lot for contributing to Moya! I've invited you to join the Moya GitHub organization – no pressure to accept! If you'd like more information on what that means, check out our contributor guidelines and feel free to reach out with any questions. |
Was happy to help :) |
Fixes #1406