I am trying the Siesta framework and I want to call a function before sending every API calls.
I saw that decorateRequests(with:)
is best suited for what I am looking to do, but as the return value must be a Request
, there's an error on the following code:
service.decorateRequests(with: { (res, req) -> Request in
if (res.url == self.tests.url) {
// do things..., then call req.repeated()
} else {
req.repeated()
}
})
However, I have this error:
Missing return in a closure expected to return 'Request'
Any idea how I can make it work? Thanks