Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Brandon Hudgeons
    @bhudgeons
    Yep ... it does. Thanks @travisbrown!
    jeremyrsmith
    @jeremyrsmith
    :disappointed: I must not have tagged it
    Brandon Hudgeons
    @bhudgeons
    @jeremyrsmith no worries!
    harrydevnull
    @harrydevnull
    hi is there an example of downloading a file from another webservice?
    may be the question can be phrased to are there any feather-bed decoders out of the box for decoding binary content?
    jeremyrsmith
    @jeremyrsmith
    @harrydevnull IIRC you can always get a Buf which gives you the bytes.
    harrydevnull
    @harrydevnull
    any code samples? @jeremyrsmith
    jeremyrsmith
    @jeremyrsmith
    hmm, not really. It looks like you’d want to make your own Decoder, i.e. for PDF:
    harrydevnull
    @harrydevnull
    :disappointed:
    jeremyrsmith
    @jeremyrsmith
    implicit val pdfDecoder: Decoder.Aux[Witness.`”application/pdf”`.T, PDF] = Decoder.of(“application/pdf”) {
      response => fnFromBufToPDF(response.content)
    }
    sorry :(
    harrydevnull
    @harrydevnull
    that works :D
    jeremyrsmith
    @jeremyrsmith
    if you just want a Buf out it’s pretty trivial
    Decoder.of(“content/type”)(response => Validated.valid(_.content)) I think
    there should be an actual API for that, but there doesn’t seem to be.
    harrydevnull
    @harrydevnull
    implicit val streamDecoder: Decoder.Aux[Witness.`”application/octet-stream”`.T, PDF] = Decoder.of(“application/octet-stream”) {
      response => fnFromBufToPDF(response.content)
    }
    i wanted something on that lines...
    jeremyrsmith
    @jeremyrsmith
    yeah, actually though the function has to return Validated[PDF]
    harrydevnull
    @harrydevnull
    implicit val streamDecoder: Decoder.Aux[Witness.`”application/octet-stream”`.T, Arrya[Byte] = Decoder.of(“application/octet-stream”) {
      response => fnFromBufToPDF(response.content)
    }
    may be?
    jeremyrsmith
    @jeremyrsmith
    err ValidatedNel[Throwable, PDF]
    harrydevnull
    @harrydevnull
    cool I think I have enough to play with
    jeremyrsmith
    @jeremyrsmith
    yeah, in that case you’d want to just extract the byte array from the Buf, which there is an API for
    harrydevnull
    @harrydevnull
    thank you @jeremyrsmith
    jeremyrsmith
    @jeremyrsmith
    apologies for lack of any work on featherbed, keep meaning to merge #61 and then open up the maintainer chair, but can never find the time
    harrydevnull
    @harrydevnull
    There was one another place I was stuck was making PUT request
    Jarod Belshaw
    @jbelshaw-c7ks7s
    I have a (hopefully simple) featherbed question...
    i'm getting an error in my test..
    java.lang.NoSuchMethodError: io.circe.Printer.copy(ZZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/circe/Printer;
    i'm not sure where that's coming from. the function being called is ...

    ```def createSession(client: Client): String = {
    val d = SSession("spark", "spark1")
    val headers = """{'Content-Type': 'application/json'}"""
    val req = client.post("/sessions").withContent(d, "application/json")

    Await.result {
      req.send[Response]() map {
        response => response.contentString
      }
    }

    }```

    Jarod Belshaw
    @jbelshaw-c7ks7s
    ok, some searching on here would indicate this is a dependency conflict issue?
    harrydevnull
    @harrydevnull
    @jbelshaw-c7ks7s yeah you have a Circe dependency conflict
    update to the latest version of feather bed and it seemed to work with Circe .9
    0.9
    PraveenBabu S
    @Subramanipravee_twitter

    Hi,

    I am new to finch and learning finch HTTP APIs. Can some one help me on any documents or sample example available for multipartFileUpload ?

    Omri Hazan
    @omrihq

    I'm attempting to add a postF function that will allow me to post without content, something like:

      def postF[
        ResponseType
      ](
        endpoint: String,
        header: (String, String) = defaultHeader
      )(
        implicit
          decoder: Decoder[ResponseType]
      ): Future[Either[HttpResponseError, ResponseType]] = {
        client
          .post(s"/$endpoint")
          .accept[Coproduct.`"application/json"`.T]
          .withHeaders(header)
          .send[ResponseType]()
          .map(Right(_))
          .handle({ case error: Throwable => Left(getHttpResponse(error)) })
      }

    but I'm getting an error:

    [error]     1. If the request is a POST, PUT, or PATCH request:
                           [error]        a. The request requires a Content-Type to be defined, but one was not defined (using the withContent method)
                           [error]        b. An Encoder is required for the request's Content-Type, but one was not available in implicit scope. This is
                           [error]           usually a matter of importing the right module to obtain the Encoder instance.
                           [error]     2. Something is missing from featherbed
                           [error]       .send[ResponseType]()
                           [error]                          ^
    Brandon Hudgeons
    @bhudgeons
    Hey gang ... what are people using now for a circe-friendly REST client?
    jeremyrsmith
    @jeremyrsmith
    I’ve heard good things about Fetch