本文整理汇总了TypeScript中request-promise.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: rp
it("no response_type parameter is present" + additionalTestDescription, () => {
if (withoutStateParam) {
delete params.state;
}
delete params.response_type;
return rp({
uri: authorizeEndpoint,
qs: params,
resolveWithFullResponse: true,
followRedirect: false,
}).then((data) => {
assert.fail();
}, (data: any) => {
let location = data.response.headers.location;
assert.equal(data.statusCode, 302);
assert.equal(data.response.headers.location.indexOf(redirectUri), 0);
let parsedUrl = url.parse(location, true);
if (withoutStateParam) {
assert.equal(parsedUrl.query.state, params.state);
}
assert.equal(parsedUrl.query.state, params.state);
assert.equal(parsedUrl.query.error, "invalid_request");
});
});
开发者ID:kamilbiela,项目名称:auth360-backend,代码行数:27,代码来源:authorization.spec.ts
示例2:
}).then((response) => {
var cards = JSON.parse(response);
var card_to_move = [];
msg.send("Looking for your cards");
for(var i = 0; i < cards.length; i++){
for(var j = 0; j < cards[i].members.length; j++){
if(cards[i].members[j].username === username){
msg.send("cards found");
card_to_move.push(cards[i]);
}
}
}
if(card_to_move.length === 0){
msg.send("you don't have any card on paused");
}else{
msg.send("moving cards back to In Development list");
for(var i = 0; i < card_to_move.length; i++){
msg.send("moving card: " + card_to_move[i].name);
httpClient({
uri: "https://api.trello.com/1/cards/" + card_to_move[i].id +
"/idList?value=" + in_development_list_id + "&key=" + key + "&token=" + token,
method: "PUT"
}).then((response) => {
var card_moved = JSON.parse(response);
msg.send("card " + card_moved.name + " moved!");
}).catch((error) => {
msg.send("error: " + error);
});
}
}
}).catch((error) => {
开发者ID:DouglasPonce85,项目名称:acklen-slackbot,代码行数:31,代码来源:trelloBRB.ts
示例3: getAccessToken
/**
* Return a particle access token.
*/
async function getAccessToken(): Promise<string> {
// Request options
let options = {
method: 'POST',
uri: 'https://api.particle.io/oauth/token',
auth: {
'user': PARTICLE_CLIENT_ID,
'pass': PARTICLE_CLIENT_SECRET,
},
form: {
'grant_type': 'refresh_token',
'refresh_token': PARTICLE_REFRESH_TOKEN,
}
};
// Fetch token
console.info('Fetching access token...')
let body = await request(options).catch((err) => {
console.error('Could not retrieve access token (HTTP ' + err.response.statusCode + ')')
console.error('Are your refresh token and client credentials correct?')
throw err;
});
// Parse response
let data = await json.parse(body);
return data.access_token;
}
开发者ID:axxe,项目名称:watertemp,代码行数:30,代码来源:logger.ts
示例4: expectJSON
it('/block/7 should exist', function() {
return expectJSON(rp('http://127.0.0.1:7781/blockchain/block/7', { json: true }), {
number: 7,
issuersCount: 2,
issuersFrame: 7,
issuersFrameVar: 4
});
});
开发者ID:duniter,项目名称:duniter,代码行数:8,代码来源:branches2.ts
示例5: Promise
return await new Promise((r, rj) => requestPromise({
method: 'POST',
uri: API,
strictSSL: false,
headers,
json: true,
body: sendData
}).then(r).catch(rj));
开发者ID:martin-liu,项目名称:m-sails,代码行数:8,代码来源:WrapperService.ts
示例6: async
return async (method, path, body) => {
return await request({
method,
url: `http://localhost:${PORT}${path}`,
body,
json: true,
jar,
})
}
开发者ID:Majavapaja,项目名称:Mursushakki,代码行数:9,代码来源:Mursushakki.spec.ts
示例7: rp
checkSubscriberByEmail() {
const options = {
url: 'https://us8.api.mailchimp.com/3.0/lists/74a478b46d/members/' + md5(this.email),
method: 'GET',
headers: {
'Authorization': 'Basic ' + process.env.MAILCHIMP_API_KEY
}
}
return rp(options);
}
开发者ID:slamby,项目名称:slamby-website,代码行数:10,代码来源:mailchimp.service.ts
示例8: rb
.catch(function (err) {
logger.error(err, 'Error uploading dot file to imgur');
rb({
method: 'POST',
uri: responseURL,
body: {
text: config.messages.SystemMessages.UnexpectedSystemError,
response_type: config.slack.EPHEMERAL_RESPONSE_TYPE
},
json: true
});
})
开发者ID:ObjectiveTruth,项目名称:Graphvizzer,代码行数:12,代码来源:createImgurLinkForDotString.ts
注:本文中的request-promise.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论