HTTP: RequestBuilder: blocking marshalling of RequestEntity
- Dominant language
- Scala
- Stars
- 1.4k
- Forks
- 584
- Avg merge
- 14h 33m
- Merged PRs (30d)
- 24
Description
**Issue by [markusjura](https://github.com/markusjura)**
_Monday Nov 23, 2015 at 08:05 GMT_
_Originally opened as https://github.com/akka/akka/issues/18992_
---
The [RequestBuilder](https://github.com/akka/akka/blob/releasing-akka-stream-and-http-experimental-2.0-M1/akka-http/src/main/scala/akka/http/scaladsl/client/RequestBuilding.scala#L47) can be used to create an `HttpRequest` object. One `apply` method uses `Await.result` to marshal the scala object to a `RequestEntity`. This means that this blocks the current thread on the execution context provided: https://github.com/akka/akka/blob/releasing-akka-stream-and-http-experimental-2.0-M1/akka-http/src/main/scala/akka/http/scaladsl/client/RequestBuilding.scala
Instead we could return a `Future[RequestEntity]` for the apply methods which pass in the `content` as `T` and not directly as `RequestEntity`.
Contributor guide
Research direction
Start in akka-http/src/main/scala/akka/http/scaladsl/client/RequestBuilding.scala, especially the RequestBuilder apply methods that accept content as T. Trace the Await.result marshalling path and assess the Future[RequestEntity] API proposed in the issue; done means those overloads no longer block the execution context and their callers remain coherent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100