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
protected Butter butter
- errOn4xx
ErrOn4xxMiddleware errOn4xx()
- errOn5xx
ErrOn5xxMiddleware errOn5xx()
- findMiddleware
virtual override ButterMiddleware? findMiddleware(Type middlewareType, Bool checked := true)
- followRedirects
FollowRedirectsMiddleware followRedirects()
- gzip
GzipMiddleware gzip()
- make
new make(Butter butter)
- middleware
virtual override ButterMiddleware[] middleware()
- sendRequest
virtual override ButterResponse sendRequest(ButterRequest req)
- stickyCookies
StickyCookiesMiddleware stickyCookies()
- stickyHeaders
StickyHeadersMiddleware stickyHeaders()
- trap