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

tech.ytsaurus.spark.launcher.rest.YtHeaderFormat.scala Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package tech.ytsaurus.spark.launcher.rest

import org.scalatra.servlet.RichRequest
import tech.ytsaurus.core.YtFormat
import tech.ytsaurus.ysontree.YTreeTextSerializer

sealed trait YtHeaderFormat

object YtHeaderFormat {
  val ysonTextFormat: String = YTreeTextSerializer.serialize(YtFormat.YSON_TEXT)

  case object Yson extends YtHeaderFormat

  case object Unknown extends YtHeaderFormat

  def fromHeader(implicit request: RichRequest): YtHeaderFormat = {
    request.headers.get("X-YT-Header-Format") match {
      case Some(format) if format == ysonTextFormat => Yson
      case _ => Unknown
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy