Skip to content
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

Merged
merged 4 commits into from
Oct 28, 2017
Merged

Added missing content type for requestJSONEncodable task #1410

merged 4 commits into from
Oct 28, 2017

Conversation

Vict0rS
Copy link
Contributor

@Vict0rS Vict0rS commented Oct 25, 2017

Fixes #1406

@MoyaBot
Copy link

MoyaBot commented Oct 25, 2017

SwiftLint found issues

Warnings

File Line Reason
EndpointSpec.swift 274 Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.
EndpointSpec.swift 275 Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.

Generated by 🚫 Danger

Copy link
Contributor

@BasThomas BasThomas left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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-io
Copy link

codecov-io commented Oct 25, 2017

Codecov Report

Merging #1410 into master will decrease coverage by 1.97%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
Sources/Moya/URLRequest+Encoding.swift 88.23% <100%> (ø)
Sources/Moya/Plugin.swift 75% <0%> (ø)
Sources/Moya/TargetType.swift 100% <0%> (ø)
Sources/Moya/Endpoint.swift 93.44% <0%> (ø)
Sources/Moya/Plugins/NetworkActivityPlugin.swift 100% <0%> (ø)
Sources/Moya/Plugins/CredentialsPlugin.swift 100% <0%> (ø)
Sources/Moya/URL+Moya.swift 100% <0%> (ø)
Sources/Moya/Plugins/NetworkLoggerPlugin.swift 91.8% <0%> (ø)
Sources/Moya/MoyaProvider+Defaults.swift 76% <0%> (ø)
Sources/Moya/MultipartFormData.swift 55% <0%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a7451f...f72d5ed. Read the comment docs.

Copy link
Contributor

@BasThomas BasThomas left a 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? :)

@Vict0rS
Copy link
Contributor Author

Vict0rS commented Oct 25, 2017

Changelog and tests are updated.

@BasThomas
Copy link
Contributor

Hey @Vict0rS - I think some other tests were impacted by this change. See here. Can you check if everything works fine locally?

@Vict0rS
Copy link
Contributor Author

Vict0rS commented Oct 26, 2017

It seems like there are some network connection inconsistencies. When I run tests locally they appear to pass or fail at random. The failing test requires to upload image in 5 seconds so definitely looks like network connection inconsistency.
screen shot 2017-10-26 at 20 11 31

@Vict0rS
Copy link
Contributor Author

Vict0rS commented Oct 26, 2017

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.

@sunshinejr
Copy link
Member

sunshinejr commented Oct 28, 2017

You are right @Vict0rS, both tests that were failing are not your fault, I've created an issue for this one (#1424).

Copy link
Member

@sunshinejr sunshinejr left a 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! 💯

@sunshinejr sunshinejr merged commit f615ec0 into Moya:master Oct 28, 2017
@ashfurrow
Copy link
Member

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.

@Vict0rS
Copy link
Contributor Author

Vict0rS commented Oct 28, 2017

Was happy to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants