classafButter::ButterResponse

sys::Obj
  afButter::ButterResponse

The HTTP response.

asBuf

Source

Buf asBuf()

Return the response stream as a Buf.

This method closes the response stream.

asInStream

Source

InStream asInStream()

Returns the body as an InStream.

asJson

Source

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

Source

Str:Obj 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

Source

Str asStr()

Reads the response stream and converts it to a Str using the charset defined in the Content-Type header.

This method closes the response stream.

body

Source

Buf body

The request body.

data

Source

Str:Obj data := [Str:Obj][:]

A temporary store for request data, use to pass data between middleware.

headers

Source

HttpResponseHeaders headers

The HTTP repsonse headers.

make

Source

new make(|This in)

it-block ctor.

makeFromInStream

Source

new makeFromInStream(InStream in)

Creates a response reading real HTTP values from an InStream. The whole response body is read in.

makeFromStr

Source

new makeFromStr(Int statusCode, Str statusMsg, Str:Str headers, Str body, |This? f := null)

Create a response from a Str body.

statusCode

Source

Int statusCode

The HTTP status code.

statusMsg

Source

Str statusMsg

The HTTP status message.

version

Source

Version version := Butter.http11

HTTP version of the response.