Victor Gunnarsson
Victor Gunnarsson

Reputation: 320

Akka chunk size exception

I am trying to make a singleRequest from Akka using this code:

val request = HttpRequest(
  method = HttpMethods.GET,
  uri = "url"
)
val responseFuture: Future[HttpResponse] = Http().singleRequest(request)
val entityFuture: Future[HttpEntity.Strict] = responseFuture.flatMap(response => response.entity.toStrict(2.seconds))
entityFuture.map(entity => entity.data.utf8String)

However when I request a big json string I get the following exception.

akka.http.scaladsl.model.EntityStreamException: HTTP chunk size exceeds the configured limit of 1048576 bytes

How do I configure this, I am not using Akka typed(I think), just this:

  implicit val system = ActorSystem() 
  implicit val materializer = ActorMaterializer() 
  import system.dispatcher 

Upvotes: 2

Views: 1235

Answers (1)

Janith
Janith

Reputation: 2910

You can use the following configuration to increase the request size:

akka.http.parsing.max-chunk-size = 16m

Upvotes: 2

Related Questions