Я использую Play-Framework-2.6, я получаю эту ошибку /myproject/app/controllers/Application.scala:151: недостаточно
arguments for method apply: (data: akka.stream.scaladsl.Source[akka.util.ByteString, _], contentLength: Option[Long], contentType: Option[String])play.api.http.HttpEntity.Streamed in object Streamed.
[error] Unspecified value parameters contentLength, contentType.
[error] body = HttpEntity.Streamed(responseStream)
[error] ^
вот мой код
def prometheusMetrics = Action {
val responseStream = Concurrent.unicast[Array[Byte]] { channel =>
val writer = new WriterAdapter(channel)
TextFormat.write004(writer, CollectorRegistry.defaultRegistry.metricFamilySamples())
writer.close()
}
Result(
header = ResponseHeader(200, Map.empty),
body = HttpEntity.Streamed(responseStream)
).as(TextFormat.CONTENT_TYPE_004)
}
Я исследовал это, но я не нашел подходящего решения для него. Пожалуйста, помогите мне
Обновление # 1 ответ, данный пользователем @James Whiteley после выполнения этого
Result(
header = ResponseHeader(200, Map.empty),
body = HttpEntity.Streamed(responseStream, None, None)
).as(TextFormat.CONTENT_TYPE_004)
Я получаю
type mismatch;
[error] found : play.api.libs.iteratee.Enumerator[Array[Byte]]{implicit val pec: scala.concurrent.ExecutionContext}
[error] required: akka.stream.scaladsl.Source[akka.util.ByteString, _]
[error] body = HttpEntity.Streamed(responseStream, None, None)