Using toStrict on HttpRequest in Akka HTTP

We make a mechanism for retrying sending HttpRequest via Http.singleRequest()
Here is example:

val httpRequestFuture = for
	entity <- Marshal("someLongString").to[RequestEntity]
	httpRequest = HttpRequest(method = HttpMethods.POST, uri = "some-url", entity = entity)
} yield (httpRequest)

and use httpRequest in a function like this

def retryHttpRequestsUtils(httpRequest : HttpRequest, retryCounter : Int)

In the receiving side, it’s mandatory to use entity.toStrict(STRICT_TIMEOUT) when do work with entity several times, for example, Unmashaling twice.

We reuse the same HttpRequest that contains Entity.
Should we make an entity Strict Entity in this case also?


Hi @MeniSamet,

is the question whether you need to use toStrict for the HttpRequest you create in the code snippet above? You probably don’t have to because Marshal(someString) should already produce a strict entity. If you want to be sure, either use HttpEntity.isStrict or just call toStrict which will be a no-op if the entity already is strict.