Skip to content

Commit

Permalink
Upgrade Finagle version to 19.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TAKESHI SHIMADA committed Jun 29, 2019
1 parent f9f6557 commit 9cd44f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sbt._
object Dependencies {

val versions = new {
val twitter = "19.5.1"
val twitter = "19.6.0"
val guice = "4.0"
val logback = "1.2.3"
val mockito = "1.10.19"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import com.twitter.finagle.http.{Method, Request, Response}
import com.twitter.io.Buf.ByteArray.Owned.extract
import com.twitter.util.Future
import com.roundeights.hasher.Implicits._
import org.jboss.netty.handler.codec.http.HttpHeaders.Names._
import io.netty.handler.codec.http.HttpHeaderNames._

class ETagFilter extends SimpleFilter[Request, Response] {

override def apply(request: Request, service: Service[Request, Response]): Future[Response] = {
service(request).map({response =>
if (request.method == Method.Get && response.statusCode == 200) {
val tag = extract(response.content).md5.hex
if (request.headerMap.get(IF_NONE_MATCH) == Some(tag)) {
if (request.headerMap.get(IF_NONE_MATCH.toString) == Some(tag)) {
Response(request.version, http.Status.NotModified)
} else {
response.headerMap(ETAG) = tag
response.headerMap(ETAG.toString) = tag
response
}
} else {
Expand Down

0 comments on commit 9cd44f3

Please sign in to comment.