it('should allow using middleware', function (done) { var options = { url: 'http://localhost:8012/api/stores', json: true }; request.del(options, function (error, response, body) { if (error) return done(error); expect(response.statusCode).to.be(200); expect(response.headers['x-poncho']).to.be('Poncho!'); done(); }); });
it('should allow mounting of subcontrollers (DEL plural)', function (done) { var options = { url: 'http://localhost:8012/api/stores/123/tools', json: true }; request.del(options, function (error, response, body) { if (error) return done(error); expect(response.statusCode).to.be(200); expect(body).to.be(3); done(); }); });
it('should allow parent to function when mounting subcontrollers (DELETE singular)', function (done) { var options = { url: 'http://localhost:8012/api/stores/Westlake', json: true }; request.del(options, function (error, response, body) { if (error) return done(error); expect(response.statusCode).to.be(200); expect(body).to.be(1); done(); }); });
it('should allow parent to function when mounting subcontrollers (DELETE plural)', function (done) { var options = { url: 'http://localhost:8012/api/v1/stores/', json: true }; request.del(options, function (error, response, body) { if (error) return done(error); expect(response).to.have.property('statusCode', 200); expect(body).to.be(2); done(); }); });
function del(id, done) { if (!done) { done = id; id = null; } var path = '/db'; path += id ? "/" + id : ""; request.del({ url: Url(path), json: true }, done); }
var deleteJob = request.del(options, function(error, response, body) { var options = { uri: 'http://' + address + ':80/v1/packages/' + package_uuid, headers: { 'Authorization': 'Bearer ' + accesstoken}}; var deletePackage = request.del(options, function(error, response, body) {}); setTimeout(function() { var options = { uri: 'http://127.0.0.1:' + port + '/getjobs'}; var display_app = request.get(options, function(error, response, body) { res.end(body); }, 2000); }); });
LawForm.prototype.removeClause = function(id) { var clause = o('[data-clause=' + id + ']'); request .del('/api' + this.action + '/clause') .send({ clause: id }) .end(function (err, res) { if (err || !res.ok) return log('Found error %o', err || res.error); clause.parentNode.removeChild(clause); clause.remove(); }); }
checkProvidersCount(1, function() { request.del(helper.requestFields('DELETE', '/providers/' + name + '.json', { provider: root.name }, root, { name: name }), function(err, httpResponse, body) { assert(!err, err); assert.equal(httpResponse.statusCode, 200); assert.equal(body.name, name); assert.equal(JSON.stringify(body.flags), JSON.stringify({ check_sign: 0, check_token: 0, manage_providers: 0 })); assert.equal(body.sign_iv.length, 32); assert.equal(body.sign_key.length, 64); checkProvidersCount(0, done); }); });
request.get('http://localhost:3030/items/1', function () { console.log('6. Updated item at GET /items/1.'); printStatusAndBody.apply(null, arguments); request.del('http://localhost:3030/items/1', function () { console.log('7. Deleted item at GET /items/1.'); printStatusAndBody.apply(null, arguments); request.get('http://localhost:3030/items/1', function () { console.log('7. Can no longer request item at GET /items/1.'); printStatusAndBody.apply(null, arguments); }); }); });
it('DELETE /Customers/:id 204', function (done) { request.del({ url: util.format('%s/api/v1/Customers/%s', testUrl, customer._id) }, function (err, res, body) { assert.ok(!err) assert.equal(res.statusCode, 204) assert.equal(options.preDelete.length, 2) sinon.assert.calledOnce(options.preDelete[0]) sinon.assert.calledOnce(options.preDelete[1]) done() }) })
it('DELETE /Customer/:id 204', (done) => { request.del({ url: `${testUrl}/api/v1/Customer/${customer._id}` }, (err, res, body) => { assert.ok(!err) assert.equal(res.statusCode, 204) assert.equal(options.preDelete.length, 2) sinon.assert.calledOnce(options.preDelete[0]) sinon.assert.calledOnce(options.preDelete[1]) done() }) })
function stop( address, token, app_id, callback ) { console.log('Stopping...'); req = request.del({ url: 'http://' + address + '/api/manager/devkit/' + app_id, headers: { 'Authorization': 'Bearer ' + token }, json: true }, callback); }
return new Promise(function(resolve, reject){ request.del({ url: url, headers: headers, body: JSON.stringify(data) }, function (err, response, body) { if (err) { return resolve({code: 1, error_msg: 'Something went wrong', response: err}); } resolve( JSON.parse(body) ); }) })
return new Promise((resolve) => { const url = endpoint + 'api/MobilSoegProfiles/' + mobilSoegProfileId + '/likes'; request.del( { url: url, form: {} }, (err, httpResponse) => { resolve(httpResponse); } ); });
api.deleteTemplate = function (accessToken, strategy, done) { request.del({ url: this.apiUrl + '/connection-templates/' + strategy, headers: { 'Authorization': 'Bearer ' + accessToken, } }, function (err, r, body) { if (err) { return done(err); } if (r.statusCode.toString().substr(0, 1) !== '2') { return done(new ApiError(body, r.statusCode)); } done(); }); };
.then(function (exists) { if (exists) { request.del(url, function (err, res, body) { if (err || body.error) deferred.reject(body); else deferred.resolve(true); }); } else { deferred.resolve(true); } });
before(function (done) { request.del('http://*****:*****@test.test',function (error, response, body) { if (!error && response.statusCode == 200) { user = JSON.parse(body); } if (!error && response.statusCode == 404) { exists = true; } done(); }) });
// Handles purging of the queue function purgeQueue(queueNameToPurge) { var url = format(purgeQueueSpecification, queueNameToPurge); console.log('request to: ' + url); request .del(url) .auth(auth.user, auth.pass) .on('error', function(err) { console.error('error: ' + err); }) .pipe(process.stdout); }
function _deleteJob(req, res) { var targetDoc = _couchurl + '/_replicator/' + req.param('id') + '?rev=' + req.param('rev'); request.del(targetDoc, function(err, delRes, body) { debug('DELETE: ' + targetDoc, body); if (err) { req.message(err, 'error'); } res.redirect('/replication'); }); } // _deleteJob
it('fails when deleting collections with invalid class names', done => { request.del({ url: 'http://localhost:8378/1/schemas/_GlobalConfig', headers: masterKeyHeaders, json: true, }, (error, response, body) => { expect(response.statusCode).toEqual(400); expect(body.code).toEqual(Parse.Error.INVALID_CLASS_NAME); expect(body.error).toEqual('Invalid classname: _GlobalConfig, classnames can only have alphanumeric characters and _, and must start with an alpha character '); done(); }) });
it('can\'t delete a non existent post', function (done) { request.del({uri: testUtils.API.getApiURL('posts/99/'), headers: {'X-CSRF-Token': csrfToken}}, function (error, response, body) { response.should.have.status(404); should.not.exist(response.headers['x-cache-invalidate']); response.should.be.json; var jsonResponse = JSON.parse(body); jsonResponse.should.exist; testUtils.API.checkResponseValue(jsonResponse, ['error']); done(); }); });
RESTClient.prototype.del = function (name, callback,errorHandler) { this.validateParam(); var LOG_TITLE = 'RESTClient.del' var path = this.path + '/' + encodeURIComponent(name) + '?key=' + this.key+'&tenantId='+this.tenantId+'&force='+true; var port = this.port||443; var options = { url : "https://" + this.host +":"+port+ path, method : 'DELETE' } request.del(options,this.resultHandler(LOG_TITLE,callback,errorHandler)); }
, function (req, res) { var request = require('request'); var path = 'silence/' + req.params.client; request.del({ url: app.get('sensu_uri') + '/stashes/' + path, json: true } , function (error, response) { if(error){ res.send(500); } else { res.send(204); } }); });
d('deleteDoc', function (name, id, rev, cb) { if (!cb) { throw new Error('Callback must be a function'); } request.del(this.place + '/' + name + '/' + id + '?rev=' + rev, function (error, response, data) { data = JSON.parse(data); if (response.statusCode === 200) { cb(null, data); } else { cb(error || data); } }); });
.then(() => { request.del({ url: 'http://localhost:8378/1/schemas/HasAllPOD', headers: masterKeyHeaders, json: true, }, (error, response, body) => { expect(response.statusCode).toEqual(400); expect(body.code).toEqual(255); expect(body.error).toMatch(/HasAllPOD/); expect(body.error).toMatch(/contains 1/); done(); }); });
it('should delete all documents in addressed collection', function (done) { var options = { url: 'http://localhost:8012/api/vegetables/', json: true }; request.del(options, function (err, response, body) { if (err) return done(err); expect(response.statusCode).to.be(200); // Check that the correct number were deleted. expect(body).to.be(8); done(); }); });
it('app.delete(\'/object/:name\', ..)'.white+' - should listen and receive "The Car was deleted!" upon visiting DELETE /user/john'.grey, function(done){ app.delete('/object/:name', function($){ $.end('The ' + $.params.name.capitalize()+' was deleted!'); }); request.del('http://localhost:9000/object/car', function(error, response, body){ if(error) throw error; assert.equal(body, 'The Car was deleted!'); assert.equal(response.statusCode, 200); assert.equal(response.headers['content-type'], 'text/plain'); done(); }); });
d('deleteView', function (name, id, rev, cb) { request.del(this.place + '/' + name + '/_design/' + id + '?rev=' + rev, function (error, response, data) { if (error) { return cb(error); } data = JSON.parse(data); if (response.statusCode === 200) { cb(null, data); } else { cb(error || data); } }); });
test('Deleting a response', function (done) { request.del({url: BASEURL + '/surveys/' + surveyId + '/responses/' + id}, function (error, response, body) { should.not.exist(error); should.exist(response); response.statusCode.should.equal(200); response.should.be.json; var parsed = JSON.parse(body); parsed.should.have.property('count').equal(1); done(); }); });
Citizen.prototype.unload = function() { this.cleanup(); this.$_path = null; request .del('/signin') .send() .end(); this.state('unloaded'); return this; };