mixinafButter::Butter
afButter::Butter
Butter instances route HTTP requests through a stack of middleware.
- churnOut
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
static ButterMiddleware[] defaultStack()The default middleware stack. It currently returns new instances of (in order):
- findMiddleware
abstract ButterMiddleware? findMiddleware(Type middlewareType, Bool checked := true)Returns an instance of the given middleware type as used by the
- get
virtual ButterResponse get(Uri uri)Makes a simple HTTP get request to the given URI and returns the response.
- http10
const static Version http10 := Version.<ctor>("1.0")A const value representing HTTP 1.0
- http11
const static Version http11 := Version.<ctor>("1.1")A const value representing HTTP 1.1
- middleware
abstract ButterMiddleware[] middleware()Returns an read only list of middleware instances used by this
Butter- postFile
virtual ButterResponse postFile(Uri uri, File file)Make a post request to the URI with the given file. The
Content-Typeis set from the file extension's MIME type, orapplication/octet-streamif unknown.- postForm
virtual ButterResponse postForm(Uri uri, Str:Str form)Make a post request to the URI with the given form data. The
Content-Typeis set toapplication/x-www-form-urlencoded.- postStr
virtual ButterResponse postStr(Uri uri, Str content, Charset charset := Charset.utf8())Make a post request to the URI with the given String. The
Content-Typeis set totext/plain.- sendRequest
abstract ButterResponse sendRequest(ButterRequest req)Makes a request and returns the response.