classafButter::ButterDish

sys::Obj
  afButter::ButterDish : afButter::Butter

Holds an instance of Butter; use to create helper classes that access your middleware.

Butter middleware classes should provide helper mixins that you can extend. These mixins should provide methods to access the middleware, making your code easier to read.

For example, without using a ButterDish:

butter := Butter.churnOut()
((FollowRedriectsMiddleware) butter.findMiddleware(FollowRedriectsMiddleware#)).enabled = true
((ErrOn5xxMiddleware) butter.findMiddleware(ErrOn5xxMiddleware#)).enabled = true

Compare with using a ButterDish:

butter := ButterDish(Butter.churnOut())
butter.followRedirects.enabled = true
butter.errOn5xx.enabled = true
butter

Source

protected Butter butter

errOn4xx

Source

ErrOn4xxMiddleware errOn4xx()

errOn5xx

Source

ErrOn5xxMiddleware errOn5xx()

findMiddleware

Source

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

followRedirects

Source

FollowRedirectsMiddleware followRedirects()

gzip

Source

GzipMiddleware gzip()

make

Source

new make(Butter butter)

middleware

Source

virtual override ButterMiddleware[] middleware()

sendRequest

Source

virtual override ButterResponse sendRequest(ButterRequest req)

stickyCookies

Source

StickyCookiesMiddleware stickyCookies()

stickyHeaders

Source

StickyHeadersMiddleware stickyHeaders()

trap

Source

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