Skip to content

Instantly share code, notes, and snippets.

@PreSoichiSumi
Created June 14, 2017 04:28
Show Gist options
  • Save PreSoichiSumi/22edef6106b4cfa9bdd35b56669c9433 to your computer and use it in GitHub Desktop.
Save PreSoichiSumi/22edef6106b4cfa9bdd35b56669c9433 to your computer and use it in GitHub Desktop.
request-promiseを使ってgetできるかのテスト
//https://github.com/request/request-promise
var rp= require('request-promise');
var options = {
uri: 'https://gist.githubusercontent.com/SoichiSumi/5bed3eb79ae8ec97b193f3ca35841990/raw/6d4beeb68822cd9d6af4a164bbfaeab3a9c050a9/test.json',
/*qs: {
access_token: 'xxxxx xxxxx' // -> uri + '?access_token=xxxxx%20xxxxx'
},*/
headers: {
'Origin':'https://github.com/',
'Referer':'https://github.com/SoichiSumi/SoichiSumi.github.io'
},
json: true // Automatically parses the JSON string in the response
};
exports.handler = (event, context, callback) => {
console.log("one");
rp(options)
.then(function (repos) {
console.log('User has %s repos', JSON.stringify(repos));
callback(null,repos);
})
.catch(function (err) {
callback(err);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment