mixinafButter::Butter

afButter::Butter

Butter instances route HTTP requests through a stack of middleware.

churnOut

Source

const 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

const static ButterMiddleware[] defaultStack()

delete

Source

virtual ButterResponse delete(Uri url)

Makes a simple HTTP DELETE request to the given URL and returns the response.

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 url)

Makes a simple HTTP get request to the given URL 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 a (modifiable) list of middleware instances used by this Butter

postFile

Source

virtual ButterResponse postFile(Uri url, File file)

Makes a HTTP POST request to the URL 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 url, Str:Str form)

Makes a HTTP POST request to the URL with the given form data. The Content-Type is set to application/x-www-form-urlencoded.

postJson

Source

virtual ButterResponse postJson(Uri url, Str? json)

Makes a HTTP POST request to the URL with the given JSON Str. The Content-Type is set to application/json.

postJsonObj

Source

virtual ButterResponse postJsonObj(Uri url, Obj? jsonObj)

Makes a HTTP POST request to the URL with the given JSON Obj. The Content-Type is set to application/json.

postStr

Source

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

Makes a HTTP POST request to the URL with the given String. The Content-Type is set to text/plain.

putJson

Source

virtual ButterResponse putJson(Uri url, Str? json)

Makes a HTTP PUT request to the URL with the given JSON string. The Content-Type is set to application/json.

putJsonObj

Source

virtual ButterResponse putJsonObj(Uri url, Obj? jsonObj)

Makes a HTTP PUT request to the URL with the given JSON Obj. The Content-Type is set to application/json.

putStr

Source

virtual ButterResponse putStr(Uri url, Str content, Charset charset := Charset.utf8())

Makes a HTTP PUT request to the URL 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.