A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/23/resumable.js/issues/160 below:

Using JSON responses rather then HTTP response status for testChunk · Issue #160 · 23/resumable.js · GitHub

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.");
                        }
                };

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4