this is what I'm getting when I'm trying to hit a box with a self signed certificate for testing
Error: 140735125684608:error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message:../deps/openssl/openssl/ssl/s23_clnt.c:741:
Please add example and reopen.
var should = require('should'),
request = require('supertest'),
express = require('express');
describe('login', function() {
it('should login', function(done) {
var user = {"username":"test","password":"test"};
request('https://localhost')
.post('/login')
.set('Content-Type', 'application/json')
.send(user)
.expect(200, done);
});
})
//error
1) login should login:
Error: DEPTH_ZERO_SELF_SIGNED_CERT
at SecurePair.
at SecurePair.EventEmitter.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:982:10)
at CleartextStream.read as _read
at CleartextStream.Readable.read (_stream_readable.js:320:10)
at EncryptedStream.write as _write
at doWrite (_stream_writable.js:226:10)
at writeOrBuffer (_stream_writable.js:216:5)
at EncryptedStream.Writable.write (_stream_writable.js:183:11)
at write (_stream_readable.js:582:24)
at flow (_stream_readable.js:591:7)
at Socket.pipeOnReadable (_stream_readable.js:623:5)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:407:10)
at emitReadable (_stream_readable.js:403:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:528:21)
Check this :
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
Most helpful comment
Check this :
http://stackoverflow.com/questions/22654479/nodejs-https-api-testing-with-mocha-and-super-test-depth-zero-self-signed-cert