On 7/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have been working with Async to build an inhouse web app, we have
> ended up using the return codes to implement some interesting
> behaviour in our clients.
>
> MochiKit is just one of the clients that uses the web service and some
> of our other processes (robots essentially) look for return codes to
> act upon. One of these codes is 202 - Accepted. We use this in
> response to requests that fire off long running processes in the
> server. The server responds with a 202 saying that it is now running
> the process and includes a location header to indicate where the
> client should go to get updates on the current status of the process.
>
> By default MochiKit doesn't treat a 202 as a success.
MochiKit is written mostly with practical considerations in mind, and
it only "knows" how to handle the specific success codes that it deals
with (the ones that you actually run into in the wild). It's easy to
make it do what you want though... something like this:
function http_2xx_ok(err) {
if (err instanceof XMLHttpRequestError && err.number >= 200 &&
err.number < 300) {
return err.req;
}
throw err;
}
var d = doXHR(...).addErrback(http_2xx_ok).addCallback(...);
-bob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---