本文整理汇总了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;
});
}