Open Danappelxx opened 8 years ago
@Danappelxx I'll have a look into it! Thanks man!
The problem with this right now, is that as we rely on the callback in order to make it async, the only way to do that would be to have some kind of timeout for each handler.
Thinking a lot about whether the callback thing is worth it vs just returning the request and response at the end of the closure.
typealias Handler = (Request, Response) -> (Request, Response)
or even
typealias Handler = (inout Request, inout Response) -> Void
but I'm not very confident with the last one
I belive we could try with something like this Tell me what do you think about it
The timeout solution seems really dirty to me since it would create a delay if a continue is indeed the last callback, and it would also get in the way if you have a long-running operation.
Perhaps you could use promises internally? I know promisekit has a useful method called when that waits for a set of promises to complete and afterwards performs an action. The example they provide is:
let search1 = MKLocalSearch(request: rq1).promise()
let search2 = MKLocalSearch(request: rq2).promise()
when(search1, search2).then { response1, response2 in
//...
}
I don't think it would be too hard to port it to fit Taylor's needs.
Alright - if nobody else will I'll play around with this when I can find the time :P
Basically if I were to have this:
currently, Taylor would return a
not found
page. I propose adding detection which correct the.Continue
to.Send
if its the last one.