Created
December 19, 2015 22:14
-
-
Save amutake/20137e120afab8f9f0ef to your computer and use it in GitHub Desktop.
bug of finch-0.9.2 (this is fixed by #485)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalaVersion := "2.11.7" | |
libraryDependencies += "com.github.finagle" %% "finch-core" % "0.9.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finch.bug | |
import io.finch._ | |
import com.twitter.io.Buf | |
import com.twitter.finagle.http._ | |
import com.twitter.util.{ Await, Duration } | |
object Main extends App { | |
val string = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
val e: Endpoint[String] = post(* ? body) { b: String => | |
// `body` RequestReader written as the below code (finch-0.9.2): | |
// | |
// ``` | |
// val buffer = ChannelBufferBuf.Owned.extract(req.content) | |
// Some(new String(buffer.array(), "UTF-8")) | |
// ``` | |
println(b.getBytes.toSeq) // filled by \0 | |
Ok((b == string).toString) //=> false | |
} | |
val service = e.toService | |
val req = RequestBuilder() | |
.url("http://localhost") | |
.buildPost(Buf.Utf8(string)) | |
val res = Await.result(service(req), Duration.fromSeconds(10)) | |
println(res.contentString) //=> false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment