Permalink
Browse files

Adding support for secure backends.

  • Loading branch information...
DanBUK committed Feb 13, 2011
1 parent 3f53d2b commit 405235a584c3854ac3711a236c8d38d25aacd97d
Showing with 5 additions and 3 deletions.
  1. +4 −2 nodester.js
  2. +1 −1 package.json
View
@@ -4,17 +4,19 @@ var fs = require('fs');
var sys = require('sys');
var headers = {'Content-Type': 'application/x-www-form-urlencoded'};
-var nodester = function (username, password, basehost) {
+var nodester = function (username, password, basehost, secure) {
if (typeof basehost != 'undefined') this.basehost = basehost;
else this.basehost = 'api.nodester.com';
+ if (typeof secure != 'undefined' && secure == true) this.proto = 'https://';
+ else this.proto = 'http://';
this.username = username;
this.password = password;
if (typeof this.username != 'undefined' && typeof this.password != 'undefined' && this.username.length > 0 && this.password.length > 0) {
var userbits = this.username + ":" + this.password + "@";
} else {
var userbits = "";
}
- this.baseurl = "http://" + userbits + this.basehost + "/";
+ this.baseurl = this.proto + userbits + this.basehost + "/";
};
function process_response(cb, errfn) {
View
@@ -1,7 +1,7 @@
{
"name": "nodester-api",
"description": "A module to allow interaction with the http://nodester.com/ platform.",
- "version": "0.1.4",
+ "version": "0.1.5",
"homepage": "http://nodester.com/",
"repository": "git://github.com/nodester/nodester-api.git",
"author": "Daniel Bartlett <dan@f-box.org> (http://danb-uk.net/)",

0 comments on commit 405235a

Please sign in to comment.