earnshark-npm
Advanced tools
Comparing version 1.0.9 to 1.0.10
42
index.js
var http = require('http'); | ||
const https = require('https'); | ||
var request = require('request'); | ||
@@ -7,26 +9,24 @@ exports.addNewSubscription = function(product_id, key, body) { | ||
// Set the headers | ||
var headers = { | ||
'User-Agent': 'Super Agent/0.0.1', | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
} | ||
// Configure the request | ||
var options = { | ||
hostname: 'https://app.earnshark.com', | ||
// port: 80, | ||
path: '/product/' + product_id + '/addsubscriptionfromapi?key='+ key, | ||
url: url, | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
headers: headers, | ||
form: body | ||
} | ||
// Start the request | ||
request(options, function (error, response, body) { | ||
if (!error && response.statusCode == 200) { | ||
// Print out the response body | ||
console.log(body) | ||
} | ||
}; | ||
var req = http.request(options, function(res) { | ||
console.log('Status: ' + res.statusCode); | ||
console.log('Headers: ' + JSON.stringify(res.headers)); | ||
res.setEncoding('utf8'); | ||
res.on('data', function (body) { | ||
console.log('Body: ' + body); | ||
}); | ||
}); | ||
req.on('error', function(e) { | ||
console.log('problem with request: ' + e.message); | ||
}); | ||
// write data to request body | ||
req.write('{"string": "Hello, World"}'); | ||
req.end(); | ||
}) | ||
} | ||
@@ -33,0 +33,0 @@ |
{ | ||
"name": "earnshark-npm", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "This is the earnshark npm", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2099
48