Allows you to create
Requests with custom logic. This is useful for taking things that are not standard network requests, and wrapping them so they look to Siesta as if they are. To create a custom request, pass your delegate to
You can also implement Siesta’s
Requestprotocol yourself, but this is a daunting task full of pitfalls and redundant effort. This protocol provides customization points for only the things custom requests typically need to customize, and provides standard behavior and sanity checks. In particular, using
- provides standard implementations for all the request hooks,
- ensures those hooks are called exactly once, even if your delegate misbehaves and reports multiple responses,
- tracks request state and ensures valid state transitions,
- polls request progress, and
- handles cancellation cleanly, preventing “response after cancel” race conditions.
Siesta itself uses this protocol to implement its own requests. Look at
RequestChainDelgatein Siesta’s source code for examples of implementing this protocol.
public protocol RequestDelegate