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):
- delete
virtual ButterResponse delete(Uri url)Makes a simple HTTP DELETE request to the given URL and returns the response.
- 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 url)Makes a simple HTTP get request to the given URL 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 a (modifiable) list of middleware instances used by this
Butter- postFile
virtual ButterResponse postFile(Uri url, File file)Makes a HTTP POST request to the URL with the given file. The
Content-TypeHTTP header is set from the file extension's MIME type, orapplication/octet-streamif unknown.- postForm
virtual ButterResponse postForm(Uri url, Str:Str form)Makes a HTTP POST request to the URL with the given form data. The
Content-TypeHTTP header is set toapplication/x-www-form-urlencoded.- postJson
virtual ButterResponse postJson(Uri url, Str? json)Makes a HTTP POST request to the URL with the given JSON Str. The
Content-TypeHTTP header is set toapplication/json.- postJsonObj
virtual ButterResponse postJsonObj(Uri url, Obj? jsonObj)Makes a HTTP POST request to the URL with the given JSON Obj. The
Content-TypeHTTP header is set toapplication/json.- postStr
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-TypeHTTP header is set totext/plain.- putJson
virtual ButterResponse putJson(Uri url, Str? json)Makes a HTTP PUT request to the URL with the given JSON string. The
Content-TypeHTTP header is set toapplication/json.- putJsonObj
virtual ButterResponse putJsonObj(Uri url, Obj? jsonObj)Makes a HTTP PUT request to the URL with the given JSON Obj. The
Content-TypeHTTP header is set toapplication/json.- putStr
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-TypeHTTP header is set totext/plain.- sendRequest
abstract ButterResponse sendRequest(ButterRequest req)Makes a request and returns the response.