jparis / qrs-interact

Inactive - QRS Interact is a simple javascript library that allows users to send queries to the Qlik Sense Repository Service.
GNU General Public License v3.0
10 stars 7 forks source link

DELETE method not working #70

Closed miguki closed 4 years ago

miguki commented 4 years ago

req.end();

is not called in DELETE method definition, so request is not taking place

miguki commented 4 years ago
this.Delete = function(path) {
        return new Promise(function(resolve, reject) {
            var r = requestDefaultParams;
            path = getFullPath(path);
            r['method'] = 'DELETE';
            r['path'] = path;

            var req = https.request(r, (res) => {
                var statusCode = res.statusCode;
                res.on('end', function() {
                        if (statusCode == 204) {
                            resolve(statusCode);
                        } else {
                            reject("Received error code: " + statusCode);
                        }
                    })
                    .on('error', function(err) {
                        reject("QRS response error:" + err);
                    });
            }).on('error', function(err) {
                reject("QRS request error:" + err);
            });
        });
    };
jparis commented 4 years ago

Oops. typo when I updated the code. Clearly don't have any tests checking deletes. Will update and also add some tests. Thanks.

miguki commented 4 years ago

Also in DELETE method https response events are not fired, so promises cannot be resolved

jparis commented 4 years ago

fixed in 6.1.0