InterceptingFloret
public protocol InterceptingFloret : Floret
An InterceptingFloret can process requests and responses.
-
If an InterceptingFloret is disabled both functions
willRequest
anddidRespond
will not be called anymore. A InterceptingFloret doesn’t need to perform any specific action.Declaration
Swift
var enabled: Bool { get set }
-
This function will be called before a request is performed. The InterceptingFlorets will be called in the order the Cauli instance got initialized with.
Using this function you can:
- inspect the request
- modify the request (update the
designatedRequest
) - fail the request (set the
result
to.error()
) return a cached or pre-calculated response (set the
result
to.result()
)
Declaration
-
This function will be called after a request is performed and the response arrived. The InterceptingFlorets will be called in the order the Cauli instance got initialized with.
Using this function you can:
modify the request
Declaration