Compare commits

...

6 Commits

Author SHA1 Message Date
6159cd56b8
Merge pull request #94 from jwulf/https
Support https for projections
2022-10-19 13:48:32 -04:00
cbf3c7bb5e
Update README.md 2022-10-14 11:06:04 -04:00
Nicolas Dextraze
b17ab0c77a
Update README.md 2020-12-16 11:05:13 -05:00
Josh Wulf
7b7ccc2eef Correct protocol detection 2019-12-11 02:54:47 +10:00
Josh Wulf
6b75d241fc Support https for projections 2019-12-11 02:47:41 +10:00
Josh Wulf
7da398eae8 Support https for projections 2019-12-11 02:39:37 +10:00
2 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,7 @@ A port of the EventStore .Net ClientAPI to Node.js
## Learning
If you want to learn more about EventSourcing/CQRS/EventModeling, you can join the virtual workshop offered by my employer Adaptech Group, see info at [https://www.adaptechgroup.com/virtual-workshop/](https://www.adaptechgroup.com/virtual-workshop/).
If you want to learn more about EventSourcing/EventModeling, you can join one of the monthly virtual workshops offered by my employer Adaptech Group, see info at [https://adaptechgroup.com/#workshop](https://adaptechgroup.com/#workshop).
## Status

View File

@ -1,4 +1,5 @@
const http = require('http');
const https = require('https');
const url = require('url');
const util = require('util');
const ProjectionCommandFailedError = require('../errors/projectionCommandFailedError');
@ -112,6 +113,7 @@ ProjectionsClient.prototype.delete = function(httpEndPoint, name, deleteEmittedS
ProjectionsClient.prototype.request = function(method, _url, data, userCredentials, expectedCode) {
const options = url.parse(_url);
const httplib = options.protocol === 'https:' ? https : http;
options.method = method;
if (userCredentials) {
options.auth = [userCredentials.username, userCredentials.password].join(':');
@ -121,7 +123,7 @@ ProjectionsClient.prototype.request = function(method, _url, data, userCredentia
const timeout = setTimeout(function () {
reject(new Error(util.format('Request timed out for %s on %s', method, _url)))
}, self._operationTimeout);
const req = http.request(options, function (res) {
const req = httplib.request(options, function (res) {
const hasExpectedCode = res.statusCode === expectedCode;
var result = '';
res.setEncoding('utf8');