-
Notifications
You must be signed in to change notification settings - Fork 20
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
[#98] implementing query parameters building methods #99
[#98] implementing query parameters building methods #99
Conversation
Codecov Report
@@ Coverage Diff @@
## master #99 +/- ##
==========================================
+ Coverage 65.11% 65.58% +0.46%
==========================================
Files 22 22
Lines 579 584 +5
Branches 10 8 -2
==========================================
+ Hits 377 383 +6
+ Misses 202 201 -1
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.
Looks very good, @vitaliihonta. I added a couple of minor comments only.
* @param value - the value | ||
* @return updated [[Uri]] | ||
**/ | ||
def param(key: String, value: String): Uri = copy(query = this.query + (key → value)) |
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.
Can you please use the non-unicode version of →
?
* @param ps - parameters | ||
* @return updated [[Uri]] | ||
**/ | ||
def ?(ps: Seq[(String, String)]): Uri = params(ps: _*) |
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.
Since Seq
can be mutable, can you specify it to a more suitable data structure, such as List
or Vector
?
@@ -1,38 +1,42 @@ | |||
import scala.language.higherKinds |
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.
We activate this flag in the build.sbt already, IIRC. Can you delete this?
@pepegar Ok, I'm fixing. implicit object StringEncoder extends Encoder[String] {
def encode(a: String): Entity = Entity.StringEntity(a)
}
implicit object StringDecoder extends Decoder[String] {
override def decode(a: Entity): Either[CodecException, String] = a match {
case Entity.StringEntity(body, _) ⇒ Right(body)
case Entity.ByteArrayEntity(bodyArr, _) ⇒ Right(new String(bodyArr, StandardCharsets.UTF_8))
}
}
implicit def deriveCodec[A](implicit D: Decoder[A], E: Encoder[A]): Codec[A] = new Codec[A] {
override def decode(a: Entity): Either[CodecException, A] = D.decode(a)
override def encode(a: A): Entity = E.encode(a)
} Should I implement such things within this PR? |
Hey @vitaliihonta! Thank you very much for this PR, looks fine to merge now. I will be merging #96 afterwards, so I'll rebase on this before. As for the other changes, you're right that we don't have an implicit method that brings an If you're happy with the changes here, I'll merge tomorrow morning :) |
Hey @pepegar |
Merging, thanks @vitaliihonta ! |
No description provided.