summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin Brown <austin@alumino.us>2019-02-25 23:26:36 +0900
committerdoug tangren <d.tangren@gmail.com>2019-02-25 09:26:36 -0500
commitad95d93204cc84cc4648a1defac786db3ddd8582 (patch)
treed5ff3ee3a8f09ed4dcb9db115fea7ffe676a64ea
parent0ae953c69ce7a336794244adc29bbc206320705d (diff)
Support multiple messages per chunk in streaming image pull (#154)
-rw-r--r--src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 7d7283f..e733440 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -197,7 +197,15 @@ impl<'a> Images<'a> {
self.docker
.stream_post::<Body>(&path.join("?"), None)
// todo: give this a proper enum type
- .and_then(|r| serde_json::from_slice::<Value>(&r[..]).map_err(Error::from))
+ .map(|r| {
+ futures::stream::iter_result(
+ serde_json::Deserializer::from_slice(&r[..])
+ .into_iter::<Value>()
+ .collect::<Vec<_>>(),
+ )
+ .map_err(Error::from)
+ })
+ .flatten()
}
/// exports a collection of named images,