• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

input-output-hk / atala-prism-building-blocks / 5488522280

07 Jul 2023 04:26PM UTC coverage: 28.076%. Remained the same
5488522280

push

web-flow
fix: Adding Apollo ADR (#573)

2617 of 9321 relevant lines covered (28.08%)

0.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/mercury/mercury-library/agent-cli-didcommx/src/main/scala/io/iohk/atala/mercury/ZioHttpClient.scala
1
package io.iohk.atala.mercury
2

3
import zio._
4
import zio.http._
5
import zio.http.model.{Header => _, _}
6
import io.iohk.atala.mercury._
7

8
object ZioHttpClient {
×
9
  val layer = ZLayer.succeed(new ZioHttpClient())
10
}
11

12
class ZioHttpClient extends HttpClient {
13

×
14
  override def get(url: String): Task[HttpResponse] =
×
15
    zio.http.Client
×
16
      .request(url)
×
17
      .provideSomeLayer(zio.http.Client.default)
×
18
      .provideSomeLayer(zio.Scope.default)
19
      .flatMap { response =>
×
20
        response.headers.toSeq.map(e => e)
×
21
        response.body.asString
22
          .map(body =>
23
            HttpResponse(
×
24
              response.status.code,
×
25
              response.headers.toSeq.map(h => Header(h.key.toString, h.value.toString)),
26
              body
27
            )
28
          )
29
      }
30

×
31
  def postDIDComm(url: String, data: String): Task[HttpResponse] =
×
32
    zio.http.Client
×
33
      .request(
34
        url = url, // TODO make ERROR type
35
        method = Method.POST,
×
36
        headers = Headers("content-type" -> "application/didcomm-encrypted+json"),
37
        // headers = Headers("content-type" -> MediaTypes.contentTypeEncrypted),
×
38
        content = Body.fromChunk(Chunk.fromArray(data.getBytes)),
39
        // ssl = ClientSSLOptions.DefaultSSL,
40
      )
×
41
      .provideSomeLayer(zio.http.Client.default)
×
42
      .provideSomeLayer(zio.Scope.default)
43
      .flatMap { response =>
×
44
        response.headers.toSeq.map(e => e)
×
45
        response.body.asString
46
          .map(body =>
47
            HttpResponse(
×
48
              response.status.code,
×
49
              response.headers.toSeq.map(h => Header(h.key.toString, h.value.toString)),
50
              body
51
            )
52
          )
53
      }
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc