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

Release/0.7.0 #59

Merged
merged 18 commits into from
Jan 7, 2019
Merged

Release/0.7.0 #59

merged 18 commits into from
Jan 7, 2019

Conversation

rybalkinsd
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Dec 29, 2018

Codecov Report

Merging #59 into master will increase coverage by 0.2%.
The diff coverage is 98.38%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master      #59     +/-   ##
===========================================
+ Coverage     94.55%   94.76%   +0.2%     
- Complexity       67       86     +19     
===========================================
  Files            17       21      +4     
  Lines           202      210      +8     
  Branches         12       13      +1     
===========================================
+ Hits            191      199      +8     
  Misses            2        2             
  Partials          9        9
Impacted Files Coverage Δ Complexity Δ
...in/kotlin/io/github/rybalkinsd/kohttp/util/json.kt 92.85% <ø> (ø) 0 <0> (ø) ⬇️
...thub/rybalkinsd/kohttp/client/DefaultHttpClient.kt 100% <ø> (ø) 0 <0> (ø) ⬇️
...lin/io/github/rybalkinsd/kohttp/dsl/HttpHeadDsl.kt 100% <ø> (ø) 0 <0> (ø) ⬇️
...thub/rybalkinsd/kohttp/client/ClientBuilderImpl.kt 100% <ø> (ø) 53 <0> (ø) ⬇️
...lin/io/github/rybalkinsd/kohttp/ext/ResponseExt.kt 93.1% <ø> (ø) 0 <0> (ø) ⬇️
...hub/rybalkinsd/kohttp/dsl/async/AsyncHttpGetDsl.kt 0% <ø> (ø) 0 <0> (ø) ⬇️
...in/kotlin/io/github/rybalkinsd/kohttp/util/form.kt 100% <ø> (ø) 0 <0> (ø) ⬇️
...in/io/github/rybalkinsd/kohttp/dsl/HttpPatchDsl.kt 100% <ø> (ø) 0 <0> (ø) ⬇️
...tlin/io/github/rybalkinsd/kohttp/dsl/HttpGetDsl.kt 100% <ø> (ø) 0 <0> (ø) ⬇️
...n/io/github/rybalkinsd/kohttp/dsl/HttpDeleteDsl.kt 100% <ø> (ø) 0 <0> (ø) ⬇️
... and 14 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 c05bbc6...83f7d43. Read the comment docs.

Copy link
Owner Author

@rybalkinsd rybalkinsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good overall. Need to improve provided tests checking request body content type.

@@ -100,9 +100,14 @@ val response: Response = httpPost {
"email" to "john.doe@gmail.com" // email=john.doe@gmail.com
}
}
// or
body {
form("login=user&email=john.doe@gmail.com")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a feeling that it’s better to provide a form content value outside httpPost { } scope to provide a more valuable case.
How do u think @shtykh

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a lot of value in it. Can you make an example please?

import okhttp3.RequestBody
import java.io.File

@HttpDslMarker
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This annotation fixes issue #57


fun body(init: BodyContext.() -> RequestBody) {
body = BodyContext().init()
fun body(contentType: String? = null, init: BodyContext.() -> RequestBody) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content type could be declared both in body and in header. Need to check who wins in okhttp. @shtykh

form("login=user&email=john.doe@gmail.com")
}
}.use {
println(it.body()?.string())
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add real checks instead of prints in this class?

import java.io.File

@HttpDslMarker
class BodyContext(type: String?) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to test for a while to understand how to deal with a multiparty later

@rybalkinsd rybalkinsd force-pushed the release/0.7.0 branch 2 times, most recently from 4a9640c to eb85626 Compare January 4, 2019 13:20
private fun MediaType.create(contentProducer: () -> Any): RequestBody {
return when (val content = contentProducer()) {
is String -> RequestBody.create(this, content)
is File -> RequestBody.create(this, content)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shtykh this is unreachable code. The reason is:

fun file(content: File): RequestBody = RequestBody.create(mediaType, content)
fun file(content: File): RequestBody = RequestBody.create(mediaType, content)
fun bytes(content: ByteArray): RequestBody = RequestBody.create(mediaType, content)

All functions invoke RequestBody.create method, but MediaType.create is not used.
The only usege is for json { } and form { }

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Owner Author

@rybalkinsd rybalkinsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will modify BodyContext class and doublecheck code coverage

@rybalkinsd
Copy link
Owner Author

@shtykh pls make a final review

@rybalkinsd rybalkinsd added this to the 0.7.0 milestone Jan 4, 2019
@rybalkinsd rybalkinsd self-assigned this Jan 4, 2019
This was referenced Jan 5, 2019
@rybalkinsd rybalkinsd merged commit dfb6707 into master Jan 7, 2019
@rybalkinsd rybalkinsd deleted the release/0.7.0 branch January 10, 2019 08:54
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.

2 participants