8000 Using JSON responses rather then HTTP response status for testChunk · Issue #160 · 23/resumable.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Using JSON responses rather then HTTP response status for testChunk #160
Closed
@relector-tuxnix

Description

@relector-tuxnix

Enabling 'testChunk' means if a chunk is not found a 404 (or non 200 HTTP status) is returned. Although this is perfectly valid API design its quite annoying to see lots of 404's in my logs etc. Can I propose the the following change:

If a chunk is found return the following JSON:

{"success":true,"message":"Chunk found."}

If a chunk is not found return the following JSON:

{"success":false,"message":"Chunk not found."}

The following code changes can be made in resumable.js:

                var testHandler = function(e) {

                        $.tested = true;

                        var status = $.status();

                        if(status=='success') {

                                var response = JSON.parse($.xhr.responseText);

                                if(response.success == false) {
                                        $.send();
                                } else {
                                        $.callback(status, $.message());
                                        $.resumableObj.uploadNextChunk();
                                }
                        } else {
                                console.log("HTTP Error.");
                        }
                };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0