/*Making http request to the api (Git hub)
create request
parse responce
wrap in a function
*/
var https = require(\"https\");
var username = \'lynndor\';
//CREATIN
Use
encodeURIComponent()to encode uriand
decodeURIComponent()to decode uri
Its because there are reserved characters in your uri. You will need to encode uri using inbuilt javascript function encodeURIComponent()
var options = {
host: 'api.github.com',
path: encodeURIComponent('/users/'+ username +'/repos'),
method: 'GET'
};
to decode encoded uri component you can use decodeURIComponent(url)