Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #210 from julienrf/ws-done

Fix WS stream behavior when iteratee is done
  • Loading branch information...
commit 7625e03550030d91a4388e8f27f02675d7f417c8 2 parents 6c158d8 + a96a22d
Sadek Drobi authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 framework/src/play/src/main/scala/play/api/libs/ws/WS.scala
View
6 framework/src/play/src/main/scala/play/api/libs/ws/WS.scala
@@ -192,7 +192,7 @@ object WS {
calculator.map(_.sign(this))
var statusCode = 0
- var iterateeP: STMPromise[Iteratee[Array[Byte], A]] = null
+ val iterateeP = Promise[Iteratee[Array[Byte], A]]()
var iteratee: Iteratee[Array[Byte], A] = null
WS.client.executeRequest(this.build(), new AsyncHandler[Unit]() {
@@ -211,9 +211,10 @@ object WS {
override def onBodyPartReceived(bodyPart: HttpResponseBodyPart) = {
if (!doneOrError) {
- val nextIteratee = iteratee.pureFlatFold(
+ iteratee = iteratee.pureFlatFold(
// DONE
(a, e) => {
+ doneOrError = true
val it = Done(a, e)
iterateeP.redeem(it)
it
@@ -226,6 +227,7 @@ object WS {
// ERROR
(e, input) => {
+ doneOrError = true
val it = Error(e, input)
iterateeP.redeem(it)
it
Please sign in to comment.
Something went wrong with that request. Please try again.