All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finagle.http.codec.TextualContentCompressor.scala Maven / Gradle / Ivy

package com.twitter.finagle.http.codec

private[finagle] object TextualContentCompressor {
  def isTextual(contentType: String): Boolean = {
    val contentTypeWithoutCharset = contentType.split(";", 2) match {
      case Array(charsetContentType, _) => charsetContentType
      case _ => contentType
    }
    val lowerCased = contentTypeWithoutCharset.toLowerCase.trim()
    lowerCased.startsWith("text/") || TextLike.contains(lowerCased)
  }

  val TextLike = Set(
    "image/svg+xml",
    "application/atom+xml",
    "application/javascript",
    "application/json",
    "application/rss+xml",
    "application/x-javascript",
    "application/xhtml+xml",
    "application/xml"
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy