diff --git a/web/testkit/src/main/scala/net/liftweb/http/testing/TestFramework.scala b/web/testkit/src/main/scala/net/liftweb/http/testing/TestFramework.scala
index 4862a6126..b5bbf39e1 100644
--- a/web/testkit/src/main/scala/net/liftweb/http/testing/TestFramework.scala
+++ b/web/testkit/src/main/scala/net/liftweb/http/testing/TestFramework.scala
@@ -84,14 +84,12 @@ trait ToBoxTheResponse {
(baseUrl + fullUrl, httpClient.executeMethod(getter)) match {
case (server, responseCode) =>
val respHeaders = slurpApacheHeaders(getter.getResponseHeaders)
+ val body = for {
+ st <- Box !! getter.getResponseBodyAsStream
+ bytes <- tryo(readWholeStream(st))
+ } yield bytes
- Full(new TheResponse(baseUrl,
- responseCode, getter.getStatusText,
- respHeaders,
- for {st <- Box !! getter.getResponseBodyAsStream
- bytes <- tryo(readWholeStream(st))
- } yield bytes,
- httpClient))
+ Full(new TheResponse(baseUrl, responseCode, getter.getStatusText, respHeaders, body, httpClient))
}
} catch {
case e: IOException => Failure(baseUrl + fullUrl, Full(e), Empty)
@@ -793,9 +791,7 @@ class HttpResponse(baseUrl: String,
code: Int, msg: String,
headers: Map[String, List[String]],
body: Box[Array[Byte]],
- theHttpClient: HttpClient) extends
- BaseResponse(baseUrl, code, msg, headers, body, theHttpClient) with
- ToResponse with TestResponse {
+ theHttpClient: HttpClient) extends BaseResponse(baseUrl, code, msg, headers, body, theHttpClient) with ToResponse with TestResponse {
}
/**
@@ -806,9 +802,7 @@ class TheResponse(baseUrl: String,
code: Int, msg: String,
headers: Map[String, List[String]],
body: Box[Array[Byte]],
- theHttpClient: HttpClient) extends
- BaseResponse(baseUrl, code, msg, headers, body, theHttpClient) with
- ToBoxTheResponse {
+ theHttpClient: HttpClient) extends BaseResponse(baseUrl, code, msg, headers, body, theHttpClient) with ToBoxTheResponse {
type SelfType = TheResponse
}
diff --git a/web/testkit/src/test/scala/net/liftweb/http/testing/MockHttpRequestSpec.scala b/web/testkit/src/test/scala/net/liftweb/http/testing/MockHttpRequestSpec.scala
index 4ccaa2786..914e53e14 100644
--- a/web/testkit/src/test/scala/net/liftweb/http/testing/MockHttpRequestSpec.scala
+++ b/web/testkit/src/test/scala/net/liftweb/http/testing/MockHttpRequestSpec.scala
@@ -20,7 +20,6 @@ import org.specs2.mutable.Specification
import org.json4s.JsonDSL._
-
/**
* System under specification for MockHttpRequest.
*/
@@ -95,7 +94,7 @@ class MockHttpRequestSpec extends Specification {
"properly set a default content type for JSON" in {
val testRequest = new MockHttpServletRequest(TEST_URL, "/test")
- testRequest.body = ("name" -> "joe")
+ testRequest.body_=("name" -> "joe")
testRequest.contentType must_== "application/json"
}
@@ -111,7 +110,7 @@ class MockHttpRequestSpec extends Specification {
"properly set a default content type for XML" in {
val testRequest = new MockHttpServletRequest(TEST_URL, "/test")
- testRequest.body =
+ testRequest.body_=()
testRequest.contentType must_== "text/xml"
}
@@ -127,7 +126,7 @@ class MockHttpRequestSpec extends Specification {
"properly set a default content type for a String" in {
val testRequest = new MockHttpServletRequest(TEST_URL, "/test")
- testRequest.body = "test"
+ testRequest.body_=("test")
testRequest.contentType must_== "text/plain"
}
diff --git a/web/testkit/src/test/scala/net/liftweb/http/testing/TestObjects.scala b/web/testkit/src/test/scala/net/liftweb/http/testing/TestObjects.scala
index 4a3d594b4..1a86e74e4 100644
--- a/web/testkit/src/test/scala/net/liftweb/http/testing/TestObjects.scala
+++ b/web/testkit/src/test/scala/net/liftweb/http/testing/TestObjects.scala
@@ -33,10 +33,8 @@ object MyCode extends TestKit {
val baseUrl = ""
val l2: TestResponse = post("/foo")
- l2.foreach {
- x: HttpResponse =>
- val l3: TestResponse = x.get("ddd")
- println("Hello")
+ l2.foreach { (x: HttpResponse) =>
+ val l3: TestResponse = x.get("ddd")
}
@@ -50,10 +48,8 @@ object MyBoxCode extends RequestKit {
def baseUrl = ""
val l2: Box[TheResponse] = post("/foo")
- l2.foreach {
- x: TheResponse =>
- val l3: Box[TheResponse] = x.get("ddd")
- println("Hello")
+ l2.foreach { (x: TheResponse) =>
+ val l3: Box[TheResponse] = x.get("ddd")
}