Skip to content

Instantly share code, notes, and snippets.

@choffmeister
Created May 5, 2015 11:24
Show Gist options
  • Save choffmeister/44369159f09c3d2aa70d to your computer and use it in GitHub Desktop.
Save choffmeister/44369159f09c3d2aa70d to your computer and use it in GitHub Desktop.
path("test") {
extract(ctx => ctx.request.entity.dataBytes) { body =>
complete {
val processing = body
.map { chunk =>
//println(s"Received ${chunk.length} bytes")
chunk
}
.map { chunk =>
// simulate slow processing speed
//Thread.sleep(100L)
chunk
}
HttpEntity.Chunked.fromData(ContentTypes.`application/octet-stream`, processing)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment