diff --git a/bower.json b/bower.json index c00dc63..7889069 100644 --- a/bower.json +++ b/bower.json @@ -31,13 +31,13 @@ "purescript-maybe": "^4.0.1", "purescript-newtype": "^3.0.0", "purescript-node-buffer": "^5.0.0", - "purescript-node-child-process": "^5.0.0", + "purescript-node-child-process": "^6.0.0", "purescript-node-fs": "^5.0.0", "purescript-node-fs-aff": "^6.0.0", "purescript-node-http": "^5.0.0", "purescript-node-streams": "^4.0.0", "purescript-nullable": "^4.1.1", - "purescript-options": "^4.0.0", + "purescript-options": "^5.0.0", "purescript-ordered-collections": "^1.6.1", "purescript-prelude": "^4.0.1", "purescript-psci-support": "^4.0.0", diff --git a/src/HTTPure/Body.purs b/src/HTTPure/Body.purs index affc010..347e8f1 100644 --- a/src/HTTPure/Body.purs +++ b/src/HTTPure/Body.purs @@ -82,8 +82,10 @@ instance bodyChunked :: read :: HTTP.Request -> Aff.Aff String read request = Aff.makeAff \done -> do let stream = HTTP.requestAsStream request - buf <- Ref.new "" - Stream.onDataString stream Encoding.UTF8 \str -> - void $ Ref.modify (_ <> str) buf - Stream.onEnd stream $ Ref.read buf >>= Either.Right >>> done + bufs <- Ref.new [] + Stream.onData stream \buf -> + void $ Ref.modify (_ <> [buf]) bufs + Stream.onEnd stream do + body <- Ref.read bufs >>= Buffer.concat >>= Buffer.toString Encoding.UTF8 + done $ Either.Right body pure Aff.nonCanceler