Hi, I'm trying to form a multi-part form data but can't figure out how, so far is what i wrote:
object FileUploadSpike2 extends App { implicit val system = ActorSystem() implicit val materializer = ActorFlowMaterializer() import system.dispatcher val authorization = headers.Authorization(BasicHttpCredentials("xxxxxx", "xxxxxxx")) //val file = IOUtils.toByteArray(new FileInputStream(new File(""))); val path = Paths.get("/UNWOMEN_surveyreport_ADVANCE_16Oct-short.pdf"); val data = Files.readAllBytes(path); val payload = Multipart.FormData.apply(Multipart.FormData.BodyPart.Strict.apply("file", Strict.apply(ContentTypes.`application/octet-stream`, akka.util.CompactByteString.fromArray(data, 0, data.length)))) val responseFuture: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = "http://xxxxxxx"), entity= ??) responseFuture.foreach(e => println("result: " + e.entity.toString)) } -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.