Skip to content

Commit

Permalink
Bump fs2 to 0.10.2 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Surée committed Feb 19, 2018
1 parent a6da0fd commit 0b9f7f5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ lazy val lolhttp =
commonSettings,

libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % "0.10.1",
"co.fs2" %% "fs2-core" % "0.10.2",
"io.netty" % "netty-codec-http2" % "4.1.16.Final",
"org.scalatest" %% "scalatest" % "3.0.4" % "test"
),
Expand Down
8 changes: 4 additions & 4 deletions core/src/test/scala/ServerSentEventsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ServerSentEventsTests extends Tests {
Client("localhost", server.port, options = ClientOptions(protocols = Set(protocol))).runAndStop { client =>
client.run(Get("/stream")) { response =>
response.readAs[Stream[IO,Event[String]]].flatMap { eventStream =>
eventStream.runLog.map(_.toList)
eventStream.compile.toVector.map(_.toList)
}
}
}
Expand Down Expand Up @@ -54,7 +54,7 @@ class ServerSentEventsTests extends Tests {
timeout(client.stopSync(), 1.second).unsafeRunAsync(_ => ())
client.run(Get("/streamThatSendsNothing")) { response =>
response.readAs[Stream[IO,Event[String]]].flatMap { eventStream =>
eventStream.runLog.map { e =>
eventStream.compile.toVector.map { e =>
e.toList
}
}
Expand All @@ -76,7 +76,7 @@ class ServerSentEventsTests extends Tests {
Client("localhost", server.port, options = ClientOptions(protocols = Set(protocol))).runAndStop { client =>
client.run(Get("/")) { response =>
response.readAs[Stream[IO,Event[String]]].flatMap { eventStream =>
eventStream.runLog.map(_.toList)
eventStream.compile.toVector.map(_.toList)
}
}
}
Expand All @@ -92,7 +92,7 @@ class ServerSentEventsTests extends Tests {
Client("localhost", server.port, options = ClientOptions(protocols = Set(protocol))).runAndStop { client =>
client.run(Get("/fakeStream")) { response =>
response.readAs[Stream[IO,Event[String]]].flatMap { eventStream =>
eventStream.runLog.map(_.toList)
eventStream.compile.toVector.map(_.toList)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala/ServerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ class ServerTests extends Tests {
foreachProtocol(HTTP, HTTP2) { protocol =>
withServer(Server.listen(options = ServerOptions(protocols = Set(protocol))) {
case req @ POST at url"/" =>
req.read(_.chunks.runFold(0)((size,chunk) => size + chunk.size)).map { contentSize =>
req.read(_.chunks.compile.fold(0)((size,chunk) => size + chunk.size)).map { contentSize =>
Ok(s"Received $contentSize bytes")
}
case req @ POST at url"/take/$size" =>
req.read(_.take(size.toInt).chunks.runFold(0)((size,chunk) => size + chunk.size)).map { contentSize =>
req.read(_.take(size.toInt).chunks.compile.fold(0)((size,chunk) => size + chunk.size)).map { contentSize =>
Ok(s"Took $contentSize bytes")
}
}) { server =>
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala/Tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class Tests extends FunSuite with Matchers with OptionValues with Insid
await(atMost) { Client.run(req, timeout = atMost, options = ClientOptions(protocols = Set(protocol)))(res => IO.pure(res.headers)) }
}
def getString(content: Content, codec: String = "utf-8") = new String(getBytes(content).toArray, codec)
def getBytes(content: Content): Vector[Byte] = content.stream.runLog.unsafeRunSync()
def getBytes(content: Content): Vector[Byte] = content.stream.compile.toVector.unsafeRunSync()
def bytes(data: Int*): Seq[Byte] = data.map(_.toByte)
def eventually[A](assertion: => A, timeout: FiniteDuration = 5.seconds): A = {
val start = System.currentTimeMillis
Expand Down
2 changes: 1 addition & 1 deletion json/src/test/scala/JsonTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class JsonTests extends Tests {
Client("localhost", server.port).runAndStop { client =>
client.run(Get("/stream")) { response =>
response.readAs[Stream[IO,Event[Json]]].flatMap { eventStream =>
eventStream.runLog.map(_.toList)
eventStream.compile.toVector.map(_.toList)
}
}
}
Expand Down

0 comments on commit 0b9f7f5

Please sign in to comment.