def asResult()

in app/com/gu/viewer/proxy/ProxyResult.scala [29:55]


  def asResult(proxyResult: ProxyResult): Result = proxyResult match {

    // Stream body result
    case ProxyResultWithBody(response) => {
      val resultHeaders = Seq(
        response.header(CONTENT_LENGTH).map(CONTENT_LENGTH -> _)
      ).flatten

      Status(response.status)
        .chunked(response.bodyAsSource)
        .withHeaders(resultHeaders: _*)
        .as(response.header(CONTENT_TYPE).getOrElse(TEXT))
    }

    case RedirectProxyResult(location) =>
      Redirect(location)

    case PreviewAuthRedirectProxyResult(location, session) => {
      Ok(html.loginRedirect(location))
        .withSession(session.asPlaySession)
    }

    case RedirectProxyResultWithSession(location, session) =>
      Redirect(location)
        .withSession(session.asPlaySession)

  }