Skip to content
Browse files

Change header defs in LiftResponse classes to vals.

We do this because LiftResponses are typically not serialized to
InMemoryResponses until after the S context has been uninitialized.
Since all the default headers implementations use S.getHeaders, they
were losing all headers, as S.getHeaders always returns Nil when the S
context is uninitialized.

Amongst other things, this led e.g. XmlResponse to never include a
proper Content-Type header in its response.
  • Loading branch information...
1 parent 10e2b9f commit 6d4f64f186c11792815538263de04f9a7e2b5f0f @Shadowfiend Shadowfiend committed Dec 5, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 web/webkit/src/main/scala/net/liftweb/http/LiftResponse.scala
View
10 web/webkit/src/main/scala/net/liftweb/http/LiftResponse.scala
@@ -49,7 +49,7 @@ case class CreatedResponse(xml: Node, mime: String, addlHeaders: List[(String, S
def code = 201
- def headers: List[(String, String)] = S.getHeaders(("Content-Type" -> mime) :: addlHeaders)
+ val headers: List[(String, String)] = S.getHeaders(("Content-Type" -> mime) :: addlHeaders)
def cookies: List[HTTPCookie] = Nil
@@ -674,7 +674,7 @@ case class XmlMimeResponse(xml: Node, mime: String, addlHeaders: List[(String, S
def code = 200
- def headers: List[(String, String)] = S.getHeaders(("Content-Type" -> mime) :: addlHeaders)
+ val headers: List[(String, String)] = S.getHeaders(("Content-Type" -> mime) :: addlHeaders)
def cookies: List[HTTPCookie] = Nil
@@ -685,7 +685,7 @@ class XmlResponse(val xml: Node, val code: Int, val mime: String, val cookies: L
val addlHeaders: List[(String, String)] = XmlResponse.addlHeaders) extends XmlNodeResponse {
def docType = Empty
- def headers: List[(String, String)] = S.getHeaders(("Content-Type" -> mime) :: addlHeaders)
+ val headers: List[(String, String)] = S.getHeaders(("Content-Type" -> mime) :: addlHeaders)
def out: Node = xml
}
@@ -758,7 +758,7 @@ case class AtomResponse(xml: Node, addlHeaders: List[(String, String)] = XmlResp
def code = 200
- def headers: List[(String, String)] = S.getHeaders(("Content-Type" -> "application/atom+xml; charset=utf-8") :: addlHeaders)
+ val headers: List[(String, String)] = S.getHeaders(("Content-Type" -> "application/atom+xml; charset=utf-8") :: addlHeaders)
def cookies: List[HTTPCookie] = Nil
@@ -773,7 +773,7 @@ case class OpenSearchResponse(xml: Node, addlHeaders: List[(String, String)] = X
def code = 200
- def headers: List[(String, String)] = S.getHeaders(("Content-Type" -> "application/opensearchdescription+xml; charset=utf-8") ::
+ val headers: List[(String, String)] = S.getHeaders(("Content-Type" -> "application/opensearchdescription+xml; charset=utf-8") ::
addlHeaders)
def cookies: List[HTTPCookie] = Nil

0 comments on commit 6d4f64f

Please sign in to comment.
Something went wrong with that request. Please try again.