I apologise if this is nothing to do with Zepto, but I'm having trouble tracking down to anything else. I have a POST route in my REST API that is called from a client side create method that only works if I nest the creates so that the second will only issue the POST on completion of the first. I'd prefer it to be inline/parallel and the solution I've come up with is to append a random uuid onto the urlToken of the ajax POST request to force them to be handled as unique - inspired by a bug we chased down caused by mobile safari caching aggressively. Now I haven't dived into the code on Zeptos side, but all the signs point to zepto doing something to conflate the two POSTs occurring immediately alongside each other. From what I can tell this is breaking the (NON) Idempotency of POST, so I thought it was worth bringing to your attention.
On which browsers do you have this problem?
Chrome (Version 24.0.1312.57)
I haven't tested anything else, but I guess that should have been step one! Sorry, I'll test with others and update in the comments.
Same issue on Safari Version 6.0.2 (7536.26.17)
No issue on Firefox 18.0.2
and also no issue on Opera Version 12.14 Build 1738
Should have done those tests to clarify for myself but got tunnel-vision with the dev environment we're working with. Looks like it's not the issue I thought it was.
Which errors does the error console show (F12, Esc) show when trying to run the requests at the same time? I believe to have read somewhere that Webkit has a hard limit on concurrent ajax requests.
Yeah I think I've been caught out before by it, as there is no "error" it just hits the API with one request instead of the expected two and returns the same response to both POSTs (so unless you are looking very closely you don't notice it until you begin to assert things on the data object and it's happening in two places at once on the client). Sorry to have bothered you.
Hm, i think that Webkit is supposed to queue up the requests. At least that's what Firefox is doing.
I don't understand at all what is going on—you basically provided us with no info. Do you have access to the server logs? Have you debugged the requests using Chrome's web inspector and XHR logging? Have you debugged the requests using a debugging HTTP proxy like Charles?
Zepto isn't doing anything "smart". It's simply firing off XHR requests.
If you have POST A and POST B which you fire off basically in parallel (very close to each other), but on the server B depends on A, then you're doing it wrong. There's nothing that guarantees that the requests will reach the server in the wanted order.
Closing this stale ticket. Feel free to reopen if you have new information or a proposal to fix the issue.