Skip to content

Instantly share code, notes, and snippets.

@PreSoichiSumi
Created June 14, 2017 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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