Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added User-Agent field

  • Loading branch information...
commit 009f461e2c4128d3e0ab6bc8d1be0974f84549a6 1 parent 65b0158
@rcombs authored
Showing with 16 additions and 6 deletions.
  1. +13 −4 main.js
  2. +3 −2 package.json
View
17 main.js
@@ -1,6 +1,7 @@
#!/usr/bin/env node
http = require("http");
https = require("https");
+const VERSION = "1.0.0beta-1"
function globalErrorCallback(type,code,string){
console.error("RANDOM.ORG Error: Type: "+type+", Status Code: "+code+", Response Data: "+string);
};
@@ -64,7 +65,9 @@ exports.generateIntegers = function(callback,options,errorCallback){
port: opts.secure?443:80,
method: "GET",
path: "/integers/?format=plain&num="+opts.num+"&min="+opts.min+"&max="+opts.max+"&col="+opts.col+"&base="+opts.base+"&rnd="+opts.rnd,
- headers: {}
+ headers: {
+ "User-Agent": "Random.org client for Node.js by Rodger Combs <rodger.combs@gmail.com>, version "+VERSION
+ }
},callbackFunction);
req.end();
};
@@ -106,7 +109,9 @@ exports.generateSequence = function(callback,options,errorCallback){
port: opts.secure?443:80,
method: "GET",
path: "/sequences/?format=plain&min="+opts.min+"&max="+opts.max+"&col="+opts.col+"&base="+opts.base+"&rnd="+opts.rnd,
- headers: {}
+ headers: {
+ "User-Agent": "Random.org client for Node.js by Rodger Combs <rodger.combs@gmail.com>, version "+VERSION
+ }
},callbackFunction);
req.end();
};
@@ -150,7 +155,9 @@ exports.generateStrings = function(callback,options,errorCallback){
port: opts.secure?443:80,
method: "GET",
path: "/strings/?format=plain&num="+opts.num+"&len="+opts.length+"&digits="+(opts.digits?"on":"off")+"&upperalpha="+(opts.upper?"on":"off")+"&loweralpha="+(opts.lower?"on":"off")+"&unique="+(opts.unique?"on":"off")+"&rnd="+opts.rnd,
- headers: {}
+ headers: {
+ "User-Agent": "Random.org client for Node.js by Rodger Combs <rodger.combs@gmail.com>, version "+VERSION
+ }
},callbackFunction);
req.end();
};
@@ -188,7 +195,9 @@ exports.checkQuota = function(callback,options,errorCallback){
port: opts.secure?443:80,
method: "GET",
path: "/quota/?format=plain"+(opts.ip?"&ip="+opts.ip:""),
- headers: {}
+ headers: {
+ "User-Agent": "Random.org client for Node.js by Rodger Combs <rodger.combs@gmail.com>, version "+VERSION
+ }
},callbackFunction);
req.end();
};
View
5 package.json
@@ -1,12 +1,13 @@
{
"name": "random",
- "version": "1.0.0beta",
+ "version": "1.0.0beta-1",
"description": "A Random.org client",
"keyword": [
"random",
"client",
"random.org",
- "lottery"
+ "lottery",
+ "raffle"
],
"author": "Rodger Combs <rodger.combs@gmail.com> (http://combsconnections.tk/)",
"contributors": [],
Please sign in to comment.
Something went wrong with that request. Please try again.