Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hcaptcha

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hcaptcha - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

9

index.js

@@ -45,3 +45,10 @@ const https = require('https');

.on('data', (chunk) => buffer += chunk)
.on('end', () => resolve(JSON.parse(buffer)))
.on('end', () => {
try {
const json = JSON.parse(buffer);
resolve(json);
} catch (error) {
reject(error);
}
});
});

@@ -48,0 +55,0 @@

6

package.json
{
"name": "hcaptcha",
"version": "0.1.0",
"version": "0.1.1",
"description": "Verify hCaptcha token",

@@ -25,5 +25,5 @@ "main": "index.js",

"devDependencies": {
"mocha": "^8.2.1",
"nock": "^13.1.1"
"mocha": "^9.1.3",
"nock": "^13.2.1"
}
}

@@ -75,2 +75,14 @@ 'use strict';

it('throws on invalid json response', function (done) {
nock('https://hcaptcha.com')
.post('/siteverify', 'secret=mysecret&response=token')
.reply(200, '<html lang="en">...');
verify(secret, token)
.then(done.fail)
.catch(error => {
assert.strictEqual(error.message, 'Unexpected token < in JSON at position 0')
done()
});
});
it('throws on http failure', function (done) {

@@ -82,5 +94,5 @@ nock('https://hcaptcha.com')

.then(done.fail)
.catch(() => done())
.catch(() => done());
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc