mixinafButter::Butter

afButter::Butter

Butter instances route HTTP requests through a stack of middleware.

churnOut

Source

static Butter churnOut(ButterMiddleware[] middleware := Butter.defaultStack())

Builds a pack of butter from the given middleware stack. The ordering of the stack is important.

defaultStack

Source

static ButterMiddleware[] defaultStack()

The default middleware stack. It currently returns new instances of (in order):

findMiddleware

Source

abstract ButterMiddleware? findMiddleware(Type middlewareType, Bool checked := true)

Returns an instance of the given middleware type as used by the

get

Source

virtual ButterResponse get(Uri uri)

Makes a simple HTTP get request to the given URI and returns the response.

http10

Source

const static Version http10 := Version.<ctor>("1.0")

A const value representing HTTP 1.0

http11

Source

const static Version http11 := Version.<ctor>("1.1")

A const value representing HTTP 1.1

middleware

Source

abstract ButterMiddleware[] middleware()

Returns an read only list of middleware instances used by this Butter

postFile

Source

virtual ButterResponse postFile(Uri uri, File file)

Make a post request to the URI with the given file. The Content-Type is set from the file extension's MIME type, or application/octet-stream if unknown.

postForm

Source

virtual ButterResponse postForm(Uri uri, Str:Str form)

Make a post request to the URI with the given form data. The Content-Type is set to application/x-www-form-urlencoded.

postStr

Source

virtual ButterResponse postStr(Uri uri, Str content, Charset charset := Charset.utf8())

Make a post request to the URI with the given String. The Content-Type is set to text/plain.

sendRequest

Source

abstract ButterResponse sendRequest(ButterRequest req)

Makes a request and returns the response.

trap

Source

virtual override Obj? trap(Str name, Obj?[]? args := null)