本文整理匯總了TypeScript中request.del函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript del函數的具體用法?TypeScript del怎麽用?TypeScript del使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了del函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: reject
AlbumFile.findById(fileId, (findErr: any, file: IAlbumFile) => {
if (findErr !== null) {
reject(findErr);
} else if (file === null) {
reject('file-not-found');
} else if (file.user.toString() !== user.id) {
reject('file-not-found');
} else {
request.del({
url: `http://${config.fileServer.ip}:${config.fileServer.port}/delete`,
form: {
passkey: config.fileServer.passkey,
path: file.serverPath
}
}, (err: any, _: any, res: any) => {
if (err !== null) {
return reject(err);
}
file.isDeleted = true;
file.save((saveErr: any, saved: IAlbumFile) => {
if (saveErr !== null) {
return reject(saveErr);
}
resolve(saved.toObject());
});
});
}
});
示例2: it
it('should return delete (use @del, not @delete)', (done) => {
request.del(localBaseUrl + '/delete', (err, res, body) => {
let data = assertResponse(err, res, body);
assert.equal(data, 'delete');
done();
});
});
示例3: Promise
return new Promise((resolve, reject) => {
request.del(url, options, (error, response, body) => {
if (error) {
return reject(error);
}
resolve({response, body});
})
});
示例4: Promise
let promise = new Promise((resolve, reject) => {
let relationshipEndpointString: string = _getNeo4jEntityUrl(relationshipOrRelationshipId, "relationship");
request.del(relationshipEndpointString, requestOptions, (err, response, body) => {
if (err) {
reject(err);
}
if (response.statusCode !== 204) {
reject(`Error deleting relationship. received invalid HTTP status code: ${response.statusCode}, and message: ${response.statusMessage}`);
}
resolve(true);
});
});
示例5: done
(error: any, response: any, body: any) => {
if (!error && response.statusCode == 200) {
var newPoint = JSON.parse(body);
request.del(`http://localhost:3000/api/points/${newPoint._id}`,
(error: any, response: any, body: any) => {
if (!error && response.statusCode == 200) {
} else {
done(`${response.statusCode} - ${error}\n ${body}`);
}
});
} else {
done(error);
}
}
示例6: deleteThing
// delete /{repositoryId}/thing/{thingId}
public deleteThing(
thingId: string,
callback?: (error: any, response: any) => void) {
var options = {
url: this.rootUri + "/thing/" + thingId,
headers: { 'AccessToken': this.accessKey }
};
request.del(options, function (error, response, body) {
if (!error) {
if (response.statusCode > 299) {
callback(response.statusMessage, null);
}
else {
if (body)
callback(null, JSON.parse(body));
else
callback(null, null);
}
} else
callback(error, null);
});
}
示例7: removeUser
removeUser(username) {
request.del(environment.API.REMOVE_USER + '?username=' + username, (err, res) => {
return err || res;
});
}