classafButter::ButterResponse
sys::Obj afButter::ButterResponse
The HTTP response.
- asBuf
Buf asBuf()Return the response stream as a
Buf.This method closes the response stream.
- asInStream
InStream asInStream()Returns the body as an
InStream.- asJson
Obj asJson()Returns the response stream as a JSON object. The response stream is read as a string and converted to Fantom using util::JsonInStream.
- asJsonMap
Returns the response stream as a JSON map. Exactly the same as
asJson()but casts the result to a map.Convenience for
(Str:Obj) butterResponse.asJson()- asStr
Str asStr()Reads the response stream and converts it to a
Strusing the charset defined in theContent-Typeheader.This method closes the response stream.
- body
Buf bodyThe request body.
- data
A temporary store for request data, use to pass data between middleware.
- headers
HttpResponseHeaders headersThe HTTP repsonse headers.
- make
new make(|This in)it-block ctor.
- makeFromInStream
new makeFromInStream(InStream in)Creates a response reading real HTTP values from an
InStream. The whole response body is read in.- makeFromStr
new makeFromStr(Int statusCode, Str statusMsg, Str:Str headers, Str body, |This? f := null)Create a response from a
Strbody.- statusCode
Int statusCodeThe HTTP status code.
- statusMsg
Str statusMsgThe HTTP status message.
- version
Version version := Butter.http11HTTP version of the response.