A general HttpEntity may not be Strict, so fetching the contents may
involve I/O, hence "unmarshal" returns a Future.
If you have an HttpEntity to hand and you know it to be Strict, then you
can access the "data" field to get at the bytes without going via a Future.
On Thursday, September 24, 2015 at 3:09:07 PM UTC+1, Konrad Malawski wrote:
>
> I mis-clicked when accepting this email to be pushed to the mailing list,
> sorry Jose!
> Posting on Jose's behalf, will answer soon:
>
>
> I need to sign the response, and the signature depends on the response
> entity as a String, so far I have achieve this but I couldn't figure out
> how to do it without waiting
>
> (I know, I am looking for the right solution) for the Unmarshaller to
> unmarshall the response entity. My code looks something like:
>
>
> mapResponse { response =>
>
> *val *timestamp = Instant.*now*().getEpochSecond
>
> // *FIXME: Await here, sure there is a way of access the response
> entity*
>
> *val *payload: String = DigestUtils.*md5Hex*(Await.*result*(*Unmarshal*
> (response.entity).to[String], 1.second))
>
> *val *signature = signatureGenerator.generate(timestamp,
> response.status.intValue, payload, *tolerance*)
>
> response mapHeaders (_ :+ *`X-Signature`*(signature))
>
> }
>
>
> Can anyone please advise? I've tried several other directives, but had no
> success.
>
>
> Thanks,
>
> Jose
>
>
>
>
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.