{"id":314548,"date":"2020-12-09T03:00:29","date_gmt":"2020-12-09T03:00:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=314548"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=314548","title":{"rendered":"\u0418\u0437\u0443\u0447\u0430\u044e Scala: \u0427\u0430\u0441\u0442\u044c 5 \u2014 Http Requests"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041f\u0440\u0438\u0432\u0435\u0442 \u0445\u0430\u0431\u0440! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0438\u0437\u0443\u0447\u0430\u0442\u044c Scala. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u0432 \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0438 \u0434\u0435\u043b\u0430\u044e\u0442 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u044f \u043d\u0430 \u0441\u0442\u0435\u043a Cats \u0438 http4s \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0442\u043e \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e. \u0421\u0434\u0435\u043b\u0430\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043a\u0443\u043a\u0430\u043c\u0438, \u0442\u0435\u043b\u043e\u043c \u0432 json \u0438 \u0432 form, c \u0444\u0430\u0439\u043b\u043e\u043c, \u0441 \u0445\u0435\u0434\u0435\u0440\u0430\u043c\u0438. \u0422\u0443\u0442 <a href=\"https:\/\/habr.com\/ru\/users\/hirrolot\/\" class=\"user_link\">Hirrolot<\/a> \u043c\u043d\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u0438\u043d\u0443\u0441 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442. \u0425\u043e\u0447\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043a\u0442\u043e \u0442\u043e\u0436\u0435 \u0438\u0437\u0443\u0447\u0430\u0435\u0442 Scala \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u0414\u0430 \u0438 \u043c\u0435\u043d\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u041b\u044e\u0431\u043b\u044e \u0442\u0435\u0431\u044f \u043c\u0430\u043b\u043e\u0439. \u0420\u0430\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0435 \u0431\u0443\u0434\u044c \u043b\u0430\u043f\u0448\u043e\u0439. \u042f \u0443\u0432\u0435\u0440\u0435\u043d \u0438\u0437 \u0442\u0435\u0431\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0447\u0435\u043d\u044b\u0439 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 IT. \u0414\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e \u043c\u0435\u043d\u044f \u0442\u0443\u0442 \u043d\u0435 \u0431\u044b\u043b\u043e. \u0412 \u043e\u0431\u0449\u0435\u043c \u0448\u0442\u043e\u0440\u043c\u0438\u043b\u043e \u0443 \u043c\u0435\u043d\u044f \u043d\u0430 \u043b\u0438\u0447\u043d\u043e\u043c \u0444\u0440\u043e\u043d\u0442\u0435. \u0421 \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u043e\u0431\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u044c \u0438 \u0446\u0435\u043b\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u041c\u0430\u0440\u0433\u043e. \u041f\u043e\u0442\u043e\u043c \u043c\u044b \u0440\u0430\u0441\u0441\u0442\u0430\u043b\u0438\u0441\u044c. \u041f\u043e\u0442\u043e\u043c \u044f \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u043b \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e. \u041f\u043e\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0432\u0430\u043b\u0438\u043b\u043e\u0441\u044c. \u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u0435\u0441\u044f\u0446\u044b \u043f\u0440\u043e\u0448\u043b\u0438. \u0412\u0437\u0433\u0440\u0443\u0441\u0442\u043d\u0443\u043b, \u0432\u044b\u043f\u0438\u043b \u0438 \u0440\u0435\u0448\u0438\u043b \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u044e\u0434\u0430. \u0418 \u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c. <a name=\"habracut\"><\/a><\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/503560\/\">\u0418\u0437\u0443\u0447\u0430\u044e Scala: \u0427\u0430\u0441\u0442\u044c 1 \u2014 \u0418\u0433\u0440\u0430 \u0437\u043c\u0435\u0439\u043a\u0430<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/508560\/\">\u0418\u0437\u0443\u0447\u0430\u044e Scala: \u0427\u0430\u0441\u0442\u044c 2 \u2014 Todo \u043b\u0438\u0441\u0442 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/516154\/\">\u0418\u0437\u0443\u0447\u0430\u044e Scala: \u0427\u0430\u0441\u0442\u044c 3 \u2014 \u042e\u043d\u0438\u0442 \u0422\u0435\u0441\u0442\u044b<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/517076\/\">\u0418\u0437\u0443\u0447\u0430\u044e Scala: \u0427\u0430\u0441\u0442\u044c 4 \u2014 WebSocket<\/a><\/li>\n<li>\u0418\u0437\u0443\u0447\u0430\u044e Scala: \u0427\u0430\u0441\u0442\u044c 5 \u2014 Http Requests<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/gitlab.com\/VictorWinbringer\/scalatodoapi\" rel=\"nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/a><\/li>\n<li><a href=\"https:\/\/gitlab.com\/VictorWinbringer\/scalatodoapi\/container_registry\/\" rel=\"nofollow\">\u041e\u0431\u0440\u0430\u0437\u044b docker image<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/softwaremill\/tapir\" rel=\"nofollow\">Tapir<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/http4s\/http4s\" rel=\"nofollow\">Http4s<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/typelevel\/fs2\" rel=\"nofollow\">Fs2<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/tpolecat\/doobie\" rel=\"nofollow\">Doobie<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/scalatest\/scalatest\" rel=\"nofollow\">ScalaTest<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/typelevel\/scalacheck\" rel=\"nofollow\">ScalaCheck<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/scalatest\/scalatestplus-scalacheck\" rel=\"nofollow\">ScalaTestPlusScalaCheck<\/a><\/li>\n<\/ol>\n<p>  \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:  <\/p>\n<pre><code class=\"scala\">import cats.effect.{ContextShift, IO} import domain.todos.entities.Todo import io.circe.generic.auto._ import sttp.model.CookieWithMeta import sttp.tapir.json.circe.jsonBody import sttp.tapir.{header, _}  class TestController(implicit contextShift: ContextShift[IO]) extends ControllerBase {    private val baseTestEndpoint = baseEndpoint     .in(&quot;test&quot;)     .tag(&quot;Test&quot;) \/\/\u0421\u044e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441   private val postTest = baseTestEndpoint     .summary(&quot;\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0439\u043d\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043a\u0430 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0441\u0435\u0431\u0435&quot;)     .description(&quot;\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435&quot;)     .post     .in(header[String](&quot;test_header&quot;))     .in(jsonBody[List[Todo]])     .in(cookies)     .out(header[String](&quot;test_header_out&quot;))     .out(jsonBody[List[Todo]])     .out(setCookies)     .serverLogic(x =&gt; withStatus(IO {       (x._1 + x._3.map(c =&gt; c.name + &quot;&quot; + c.value).fold(&quot;&quot;)((a, b) =&gt; a + &quot; &quot; + b), x._2, List(CookieWithMeta(name = &quot;test&quot;, value = &quot;test_value&quot;)))     })) \/\/\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441   private val runHttpRequestTes = baseTestEndpoint     .summary(&quot;\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0441\u0435\u0431\u0435&quot;)     .description(&quot;\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0441\u0435\u0431\u0435&quot;)     .get     .out(stringBody)     .serverLogic(_ =&gt; withStatus(runHttp()))    def runHttp(): IO[String] = {     ClientExamples.execute().as(&quot;Ok&quot;)   }    val endpoints = List(     postTest,     runHttpRequestTes   ) } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441:  <\/p>\n<pre><code class=\"scala\">import cats.effect.{ContextShift, IO} import com.typesafe.scalalogging.StrictLogging import domain.todos.entities.Todo import io.circe.generic.auto._ import org.http4s.circe.CirceEntityCodec.circeEntityEncoder import org.http4s.client.blaze._ import org.http4s.client.middleware.Logger import org.http4s.headers._ import org.http4s.{MediaType, Uri, _} import org.log4s._  import java.time.Instant import scala.concurrent.ExecutionContext.global  object ClientExamples extends StrictLogging {   private[this] val logger = getLogger    def execute()(implicit contextShift: ContextShift[IO]) = { \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442     BlazeClientBuilder[IO](global).resource.use { client =&gt;       logger.warn(&quot;Start Request&quot;) \/\/\u041e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u043c\u0438\u0434\u043b\u0432\u0430\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043e\u0442\u0432\u0435\u0442\u044b.  \/\/\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0431\u043e\u0434\u0438 \u0438 \u0445\u0435\u0434\u0435\u0440\u044b       val loggedClient = Logger[IO](true, true)(client) \/\/\u041f\u0430\u0440\u0441\u0438\u043c \u0430\u0434\u0440\u0435\u0441\u0441 \u0438 \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442       val uri = Uri.fromString(&quot;http:\/\/localhost:8080\/api\/v1\/test&quot;).toOption.get \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 POST \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u0447\u0442\u043e \u043c\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435       val request: Request[IO] = Request[IO](method = Method.POST, uri = uri) \/\/\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0447\u0442\u043e \u0432 json \u0442\u0435\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 todo         .withEntity(List(Todo(1, &quot;Test&quot;, 2, Instant.now()))) \/\/\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0422\u0443\u0442 \u043e\u0434\u0438\u043d \u043d\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439.         .withHeaders(Accept(MediaType.application.json), Header(name = &quot;test_header&quot;, value = &quot;test_header_value&quot;)) \/\/\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0447\u0442\u043e \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0443\u043a\u0438 \u0441 \u0442\u0430\u043a\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c         .addCookie(&quot;test_cookie&quot;, &quot;test_cookie_value&quot;) \/\/\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441       loggedClient.run(request).use(r =&gt; {         logger.warn(&quot;End Request&quot;) \/\/\u041b\u043e\u0433\u0433\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 (200, 404, 500 \u0438 \u0442.\u0434)         logger.warn(r.status.toString()) \/\/\u041b\u043e\u0433\u0433\u0438\u0440\u0443\u0435\u043c \u043e\u0442\u0432\u0435\u0442         logger.warn(r.toString()) \/\/\u041f\u0438\u0448\u0435\u043c \u0432 \u043b\u043e\u0433\u0438 \u0445\u0435\u0434\u0435\u0440\u044b \u043e\u0442\u0432\u0435\u0442\u0430. \u0422\u0430\u043c \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0435\u0441\u0442\u044c Set-Cookie         logger.warn(r.headers.toString()) \/\/bodyText \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 Stream[IO,String] \u0438 \u043c\u044b \u043b\u043e\u0433\u0433\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0435\u043c \/\/\u041c\u043e\u0436\u043d\u043e \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e json \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.         r.bodyText.map(t =&gt;  logger.warn(t)).compile.drain       })     }   } } <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u043b\u043e\u0433\u0430\u0445 \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0442\u0435\u043a\u0441\u0442:  <\/p>\n<pre><code class=\"scala\">\/\/\u041d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441  02:54:44.634 [ioapp-compute-7] INFO org.http4s.client.middleware.RequestLogger - HTTP\/1.1 POST http:\/\/localhost:8080\/api\/v1\/test Headers(Accept: application\/json, test_header: test_header_value, Cookie: &lt;REDACTED&gt;) body=&quot;[{&quot;id&quot;:1,&quot;name&quot;:&quot;Test&quot;,&quot;imageId&quot;:2,&quot;created&quot;:&quot;2020-12-08T23:54:44.627434500Z&quot;}]&quot;  \/\/\u041d\u0430\u0448 \u0441\u0442\u0430\u0442\u0443\u0441  02:54:44.641 [scala-execution-context-global-62] WARN appServices.ClientExamples - 200 OK  \/\/\u041d\u0430\u0448 \u043e\u0442\u0432\u0435\u0442 02:54:44.641 [scala-execution-context-global-62] WARN appServices.ClientExamples - Response(status=200, headers=Headers(test_header_out: test_header_value test_cookietest_cookie_value, Set-Cookie: &lt;REDACTED&gt;, Content-Type: application\/json, Date: Tue, 08 Dec 2020 23:54:44 GMT, Content-Length: 79))  \/\/\u0425\u0435\u0434\u0435\u0440\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 02:54:44.641 [scala-execution-context-global-62] WARN appServices.ClientExamples - Headers(test_header_out: test_header_value test_cookietest_cookie_value, Set-Cookie: test=test_value, Content-Type: application\/json, Date: Tue, 08 Dec 2020 23:54:44 GMT, Content-Length: 79)  \/\/\u0422\u0435\u043b\u043e (json) \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 02:54:44.643 [ioapp-compute-6] WARN appServices.ClientExamples - [{&quot;id&quot;:1,&quot;name&quot;:&quot;Test&quot;,&quot;imageId&quot;:2,&quot;created&quot;:&quot;2020-12-08T23:54:44.627434500Z&quot;}]  <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0431\u044b\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435. \u041f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0443\u043a\u0438, \u0445\u0435\u0434\u0435\u0440\u044b, \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u0442\u0430\u043c \u0444\u0430\u0439\u043b \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0443 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. \u0421\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c .withEntity \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430 \u0432\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443   <\/p>\n<pre><code class=\"scala\">\/\/\u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0444\u0430\u0439\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Part.fileData  val data = Multipart(parts = Vector(Part.formData(&quot;age&quot;,&quot;18&quot;):Part[IO])) \/\/\u0418\u043b\u0438  val data= UrlForm((&quot;age&quot;,&quot;18&quot;)) \/\/\u0418 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441   val request: Request[IO] = Request[IO](method = Method.POST, uri = uri)         .withEntity(data) <\/code><\/pre>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/531548\/\"> https:\/\/habr.com\/ru\/post\/531548\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u041f\u0440\u0438\u0432\u0435\u0442 \u0445\u0430\u0431\u0440! \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0438\u0437\u0443\u0447\u0430\u0442\u044c Scala. \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u0432 \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0438 \u0434\u0435\u043b\u0430\u044e\u0442 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u044f \u043d\u0430 \u0441\u0442\u0435\u043a Cats \u0438 http4s \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0442\u043e \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e. \u0421\u0434\u0435\u043b\u0430\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043a\u0443\u043a\u0430\u043c\u0438, \u0442\u0435\u043b\u043e\u043c \u0432 json \u0438 \u0432 form, c \u0444\u0430\u0439\u043b\u043e\u043c, \u0441 \u0445\u0435\u0434\u0435\u0440\u0430\u043c\u0438. \u0422\u0443\u0442 <a href=\"https:\/\/habr.com\/ru\/users\/hirrolot\/\" class=\"user_link\">Hirrolot<\/a> \u043c\u043d\u0435 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u0438\u043d\u0443\u0441 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442. \u0425\u043e\u0447\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u043a\u0442\u043e \u0442\u043e\u0436\u0435 \u0438\u0437\u0443\u0447\u0430\u0435\u0442 Scala \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f. \u0414\u0430 \u0438 \u043c\u0435\u043d\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u043e\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u041b\u044e\u0431\u043b\u044e \u0442\u0435\u0431\u044f \u043c\u0430\u043b\u043e\u0439. \u0420\u0430\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043d\u0435 \u0431\u0443\u0434\u044c \u043b\u0430\u043f\u0448\u043e\u0439. \u042f \u0443\u0432\u0435\u0440\u0435\u043d \u0438\u0437 \u0442\u0435\u0431\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0447\u0435\u043d\u044b\u0439 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 IT. \u0414\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e \u043c\u0435\u043d\u044f \u0442\u0443\u0442 \u043d\u0435 \u0431\u044b\u043b\u043e. \u0412 \u043e\u0431\u0449\u0435\u043c \u0448\u0442\u043e\u0440\u043c\u0438\u043b\u043e \u0443 \u043c\u0435\u043d\u044f \u043d\u0430 \u043b\u0438\u0447\u043d\u043e\u043c \u0444\u0440\u043e\u043d\u0442\u0435. \u0421 \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u043e\u0431\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u044c \u0438 \u0446\u0435\u043b\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u041c\u0430\u0440\u0433\u043e. \u041f\u043e\u0442\u043e\u043c \u043c\u044b \u0440\u0430\u0441\u0441\u0442\u0430\u043b\u0438\u0441\u044c. \u041f\u043e\u0442\u043e\u043c \u044f \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u043b \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e. \u041f\u043e\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0432\u0430\u043b\u0438\u043b\u043e\u0441\u044c. \u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u0435\u0441\u044f\u0446\u044b \u043f\u0440\u043e\u0448\u043b\u0438. \u0412\u0437\u0433\u0440\u0443\u0441\u0442\u043d\u0443\u043b, \u0432\u044b\u043f\u0438\u043b \u0438 \u0440\u0435\u0448\u0438\u043b \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u044e\u0434\u0430. \u0418 \u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-314548","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=314548"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314548\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}