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

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

01 Jun 2023 08:00AM UTC coverage: 27.25% (-0.08%) from 27.329%
5141777763

push

web-flow
chore(prism-agent): split ManagedDIDService in trait & impl (#538)

* chore(prism-agent): split the ManagedDIDService class in a trait and implementation

* chore(prism-agent): run scalafmt

* chore(prism-agent): coveralls experiment

2419 of 8877 relevant lines covered (27.25%)

0.27 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 zio.http.service._
7
import io.iohk.atala.mercury._
8

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

13
class ZioHttpClient extends HttpClient {
14

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

×
32
  def postDIDComm(url: String, data: String): Task[HttpResponse] =
×
33
    zio.http.Client
×
34
      .request(
35
        url = url, // TODO make ERROR type
36
        method = Method.POST,
×
37
        headers = Headers("content-type" -> "application/didcomm-encrypted+json"),
38
        // headers = Headers("content-type" -> MediaTypes.contentTypeEncrypted),
×
39
        content = Body.fromChunk(Chunk.fromArray(data.getBytes)),
40
        // ssl = ClientSSLOptions.DefaultSSL,
41
      )
×
42
      .provideSomeLayer(zio.http.Client.default)
×
43
      .provideSomeLayer(zio.Scope.default)
44
      .flatMap { response =>
×
45
        response.headers.toSeq.map(e => e)
×
46
        response.body.asString
47
          .map(body =>
48
            HttpResponse(
×
49
              response.status.code,
×
50
              response.headers.toSeq.map(h => Header(h.key.toString, h.value.toString)),
51
              body
52
            )
53
          )
54
      }
55
}
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