Skip to content

Commit

Permalink
util-core: Introduce Reader.readAllItems for generic types
Browse files Browse the repository at this point in the history
Problem:

Reader.readAll was Buf biased, and it should be in BufReader.

Solution:

Move `readAll(r: Reader[Buf])` to `BufReader`, while introduce
`readAllItems[A](r: Reader[A])` to the `Reader` object.

JIRA Issues: CSL-8869

Differential Revision: https://phabricator.twitter.biz/D391346
  • Loading branch information
yufangong authored and jenkins committed Oct 30, 2019
1 parent 4463e9d commit 4e8df0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/main/scala/com/twitter/server/view/IndexView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.twitter.finagle.http.Method
import com.twitter.finagle.http.Method.{Get, Post}
import com.twitter.finagle.{Service, SimpleFilter}
import com.twitter.finagle.http.{Request, Response}
import com.twitter.io.{Buf, Reader}
import com.twitter.io.{Buf, BufReader, Reader}
import com.twitter.server.util.HtmlUtils.escapeHtml
import com.twitter.server.util.HttpUtils.{expectsHtml, newResponse}
import com.twitter.util.Future
Expand Down Expand Up @@ -154,7 +154,7 @@ class IndexView(title: String, uri: String, index: () => Seq[IndexView.Entry])
case res =>
val body = Reader.fromBuf(Buf.Utf8(content))
val reader = render(title, uri, index().sorted, body)
Reader.readAll(reader).flatMap { html =>
BufReader.readAll(reader).flatMap { html =>
newResponse(
contentType = "text/html;charset=UTF-8",
content = html
Expand Down

0 comments on commit 4e8df0a

Please sign in to comment.