client/js/s3/multipart.complete.ajax.requester.js
function handleCompleteRequestComplete(id, xhr, isError) {
        var promise = pendingCompleteRequests[id],
            domParser = new DOMParser(),
            bucket = options.getBucket(id),
            key = options.getKey(id),
            responseDoc = domParser.parseFromString(xhr.responseText, "application/xml"),
            bucketEls = responseDoc.getElementsByTagName("Bucket"),
            keyEls = responseDoc.getElementsByTagName("Key");

        delete pendingCompleteRequests[id];

        options.log(qq.format("Complete response status {}, body = {}", xhr.status, xhr.responseText));

        // If the base requester has determine this a failure, give up.
        if (isError) {
            options.log(qq.format("Complete Multipart Upload request for {} failed with status {}.", id, xhr.status), "error");
        }
        else {
            // Make sure the correct bucket and key has been specified in the XML response from AWS.
            if (bucketEls.length && keyEls.length) {
                if (bucketEls[0].textContent !== bucket) {
                    isError = true;
                    options.log(qq.format("Wrong bucket in response to Complete Multipart Upload request for {}.", id), "error");
                }

                // TODO Compare key name from response w/ expected key name if AWS ever fixes the encoding of key names in this response.
            }
            else {
                isError = true;
                options.log(qq.format("Missing bucket and/or key in response to Complete Multipart Upload request for {}.", id), "error");
            }
        }

        if (isError) {
            promise.failure("Problem combining the file parts!", xhr);
        }
        else {
            promise.success({}, xhr);
        }
    }
function handleCompleteRequestComplete(id, xhr, isError) {
        var promise = pendingCompleteRequests[id],
            domParser = new DOMParser(),
            bucket = options.getBucket(id),
            key = options.getKey(id),
            responseDoc = domParser.parseFromString(xhr.responseText, "application/xml"),
            bucketEls = responseDoc.getElementsByTagName("Bucket"),
            keyEls = responseDoc.getElementsByTagName("Key");

        delete pendingCompleteRequests[id];

        options.log(qq.format("Complete response status {}, body = {}", xhr.status, xhr.responseText));

        // If the base requester has determine this a failure, give up.
        if (isError) {
            options.log(qq.format("Complete Multipart Upload request for {} failed with status {}.", id, xhr.status), "error");
        }
        else {
            // Make sure the correct bucket and key has been specified in the XML response from AWS.
            if (bucketEls.length && keyEls.length) {
                if (bucketEls[0].textContent !== bucket) {
                    isError = true;
                    options.log(qq.format("Wrong bucket in response to Complete Multipart Upload request for {}.", id), "error");
                }

                // TODO Compare key name from response w/ expected key name if AWS ever fixes the encoding of key names in this response.
            }
            else {
                isError = true;
                options.log(qq.format("Missing bucket and/or key in response to Complete Multipart Upload request for {}.", id), "error");
            }
        }

        if (isError) {
            promise.failure("Problem combining the file parts!", xhr);
        }
        else {
            promise.success({}, xhr);
        }
    }
function handleCompleteRequestComplete ( id , xhr , isError ) { var promise = pendingCompleteRequests [ id ] , domParser = new DOMParser ( ) , bucket = options . getBucket ( id ) , key = options . getKey ( id ) , responseDoc = domParser . parseFromString ( xhr . responseText , "application/xml" ) , bucketEls = responseDoc . getElementsByTagName ( "Bucket" ) , keyEls = responseDoc . getElementsByTagName ( "Key" ) ; delete pendingCompleteRequests [ id ] ; options . log ( qq . format ( "Complete response status {}, body = {}" , xhr . status , xhr . responseText ) ) ; // If the base requester has determine this a failure, give up. if ( isError ) { options . log ( qq . format ( "Complete Multipart Upload request for {} failed with status {}." , id , xhr . status ) , "error" ) ; } else { // Make sure the correct bucket and key has been specified in the XML response from AWS. if ( bucketEls . length && keyEls . length ) { if ( bucketEls [ 0 ] . textContent !== bucket ) { isError = true ; options . log ( qq . format ( "Wrong bucket in response to Complete Multipart Upload request for {}." , id ) , "error" ) ; } // TODO Compare key name from response w/ expected key name if AWS ever fixes the encoding of key names in this response. } else { isError = true ; options . log ( qq . format ( "Missing bucket and/or key in response to Complete Multipart Upload request for {}." , id ) , "error" ) ; } } if ( isError ) { promise . failure ( "Problem combining the file parts!" , xhr ) ; } else { promise . success ( { } , xhr ) ; } }
Called by the base ajax requester when the response has been received.  We definitively determine here if the
"Complete MPU" request has been a success or not.

@param id ID associated with the file.
@param xhr `XMLHttpRequest` object containing the response, among other things.
@param isError A boolean indicating success or failure according to the base ajax requester (primarily based on status code).
Called by the base ajax requester when the response has been received . We definitively determine here if the Complete MPU request has been a success or not .