Last active
November 21, 2017 06:55
-
-
Save faisal00813/4d37f86d9c8503d9b823cd9a51108f34 to your computer and use it in GitHub Desktop.
Akka-http request handler for application/octet-stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pathPrefix("user") { | |
path("msgPackTest") { | |
post { | |
extractRequest { | |
req => | |
println(req.headers) | |
req.entity match { | |
case strict: HttpEntity.Strict => | |
val resp = req.entity.dataBytes.runFold(ByteString.empty) { case (acc, b) => acc ++ b } | |
.map(x=> processMsgPackMsg(x.compact.toArray[Byte])) | |
complete { | |
resp | |
} | |
case _ => | |
complete("Ooops, request entity is not strict!") | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment