Created
February 11, 2014 22:50
-
-
Save jkyamog/8945955 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
case class TestRequestHeader(headers: Headers, method: String = "GET", uri: String = "/", path: String = "", remoteAddress: String = "127.0.0.1", version: String = "HTTP/1.1", id: Long = 666, tags: Map[String, String] = Map.empty[String, String], queryString: Map[String, Seq[String]] = Map(), secure: Boolean = false) extends RequestHeader | |
val rh = TestRequestHeader(headers = new Headers { | |
val data = Seq(play.api.http.HeaderNames.CONTENT_TYPE -> Seq("""multipart/form-data; boundary=----68766594719920667221395339924"""), play.api.http.HeaderNames.CONTENT_LENGTH -> Seq("380")) | |
}) | |
val multipartFormData = BodyParsers.parse.multipartFormData | |
val testStr = """Content-Type: multipart/form-data; boundary=---------------------------68766594719920667221395339924 | |
Content-Length: 380 | |
-----------------------------68766594719920667221395339924 | |
Content-Disposition: form-data; name="picture"; filename="README" | |
Content-Type: application/octet-stream | |
This is your new Play application | |
===================================== | |
This file will be packaged with your application, when using `play dist`. | |
-----------------------------68766594719920667221395339924-- | |
""" | |
val enumerator = Enumerator(testStr.getBytes) | |
val iteratee = multipartFormData(rh) | |
val fResult = enumerator run iteratee | |
val result = Await.result(fResult, Duration("5 seconds")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment