Permalink
Browse files

* remove deprecation warning

* bump node version to min 0.6
* add nodeunit as devDependency
* bump recaptcha version to 1.2
  • Loading branch information...
1 parent 8948361 commit b8e4d9dbeb95945fdda59d7b3c589e38d970d497 @robertkowalski robertkowalski committed Aug 8, 2012
Showing with 18 additions and 15 deletions.
  1. +1 −1 lib/recaptcha.js
  2. +5 −2 package.json
  3. +12 −12 test.js
View
2 lib/recaptcha.js
@@ -124,7 +124,7 @@ Recaptcha.prototype.verify = function(callback) {
this.data['privatekey'] = this.private_key;
var data_qs = querystring.stringify(this.data);
- var recaptcha = http.createClient(80, API_HOST);
+ var recaptcha = http.request(80, API_HOST);
var request = recaptcha.request('POST', API_END_POINT, {
host: API_HOST,
'Content-Length': data_qs.length,
View
7 package.json
@@ -1,8 +1,11 @@
{
"name": "recaptcha",
"description": "Display and verify a Recaptcha captcha",
- "version": "1.1.0",
+ "version": "1.2.0",
"author": "Michael Hampton <mirhampt+github@gmail.com>",
"main": "./lib/recaptcha.js",
- "engines": { "node": ">= 0.2.0" }
+ "devDependencies": {
+ "nodeunit": "*"
+ },
+ "engines": { "node": ">= 0.6.0" }
}
View
24 test.js
@@ -96,7 +96,7 @@ exports['verify() with no data'] = function(test) {
var create_client_called = false;
// We shouldn't need to contact Recaptcha to know this is invalid.
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
create_client_called = true;
};
@@ -105,7 +105,7 @@ exports['verify() with no data'] = function(test) {
test.strictEqual(error_code, 'verify-params-incorrect');
test.strictEqual(recaptcha.error_code, 'verify-params-incorrect');
- // Ensure that http.createClient() was never called.
+ // Ensure that http.request() was never called.
test.strictEqual(create_client_called, false);
test.done();
@@ -122,7 +122,7 @@ exports['verify() with blank response'] = function(test) {
var create_client_called = false;
// We shouldn't need to contact Recaptcha to know this is invalid.
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
create_client_called = true;
};
@@ -131,7 +131,7 @@ exports['verify() with blank response'] = function(test) {
test.strictEqual(error_code, 'incorrect-captcha-sol');
test.strictEqual(recaptcha.error_code, 'incorrect-captcha-sol');
- // Ensure that http.createClient() was never called.
+ // Ensure that http.request() was never called.
test.strictEqual(create_client_called, false);
test.done();
@@ -147,7 +147,7 @@ exports['verify() with missing remoteip'] = function(test) {
var create_client_called = false;
// We shouldn't need to contact Recaptcha to know this is invalid.
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
create_client_called = true;
};
@@ -156,7 +156,7 @@ exports['verify() with missing remoteip'] = function(test) {
test.strictEqual(error_code, 'verify-params-incorrect');
test.strictEqual(recaptcha.error_code, 'verify-params-incorrect');
- // Ensure that http.createClient() was never called.
+ // Ensure that http.request() was never called.
test.strictEqual(create_client_called, false);
test.done();
@@ -172,7 +172,7 @@ exports['verify() with missing challenge'] = function(test) {
var create_client_called = false;
// We shouldn't need to contact Recaptcha to know this is invalid.
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
create_client_called = true;
};
@@ -181,7 +181,7 @@ exports['verify() with missing challenge'] = function(test) {
test.strictEqual(error_code, 'verify-params-incorrect');
test.strictEqual(recaptcha.error_code, 'verify-params-incorrect');
- // Ensure that http.createClient() was never called.
+ // Ensure that http.request() was never called.
test.strictEqual(create_client_called, false);
test.done();
@@ -197,7 +197,7 @@ exports['verify() with missing response'] = function(test) {
var create_client_called = false;
// We shouldn't need to contact Recaptcha to know this is invalid.
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
create_client_called = true;
};
@@ -206,7 +206,7 @@ exports['verify() with missing response'] = function(test) {
test.strictEqual(error_code, 'verify-params-incorrect');
test.strictEqual(recaptcha.error_code, 'verify-params-incorrect');
- // Ensure that http.createClient() was never called.
+ // Ensure that http.request() was never called.
test.strictEqual(create_client_called, false);
test.done();
@@ -238,7 +238,7 @@ exports['verify() with bad data'] = function(test) {
var fake_request = new events.EventEmitter();
var fake_response = new events.EventEmitter();
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
test.strictEqual(port, 80, 'port correct in createClient() call');
test.strictEqual(host, 'www.google.com', 'host correct in createClient() call');
return fake_client;
@@ -304,7 +304,7 @@ exports['verify() with good data'] = function(test) {
var fake_request = new events.EventEmitter();
var fake_response = new events.EventEmitter();
- http.createClient = function(port, host) {
+ http.request = function(port, host) {
test.strictEqual(port, 80, 'port correct in createClient() call');
test.strictEqual(host, 'www.google.com', 'host correct in createClient() call');
return fake_client;

0 comments on commit b8e4d9d

Please sign in to comment.