Compare commits
6 Commits
c67d0d25a2
...
6159cd56b8
Author | SHA1 | Date | |
---|---|---|---|
6159cd56b8 | |||
cbf3c7bb5e | |||
|
b17ab0c77a | ||
|
7b7ccc2eef | ||
|
6b75d241fc | ||
|
7da398eae8 |
@ -3,7 +3,7 @@ A port of the EventStore .Net ClientAPI to Node.js
|
|||||||
|
|
||||||
## Learning
|
## 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
|
## Status
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
const http = require('http');
|
const http = require('http');
|
||||||
|
const https = require('https');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const ProjectionCommandFailedError = require('../errors/projectionCommandFailedError');
|
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) {
|
ProjectionsClient.prototype.request = function(method, _url, data, userCredentials, expectedCode) {
|
||||||
const options = url.parse(_url);
|
const options = url.parse(_url);
|
||||||
|
const httplib = options.protocol === 'https:' ? https : http;
|
||||||
options.method = method;
|
options.method = method;
|
||||||
if (userCredentials) {
|
if (userCredentials) {
|
||||||
options.auth = [userCredentials.username, userCredentials.password].join(':');
|
options.auth = [userCredentials.username, userCredentials.password].join(':');
|
||||||
@ -121,7 +123,7 @@ ProjectionsClient.prototype.request = function(method, _url, data, userCredentia
|
|||||||
const timeout = setTimeout(function () {
|
const timeout = setTimeout(function () {
|
||||||
reject(new Error(util.format('Request timed out for %s on %s', method, _url)))
|
reject(new Error(util.format('Request timed out for %s on %s', method, _url)))
|
||||||
}, self._operationTimeout);
|
}, self._operationTimeout);
|
||||||
const req = http.request(options, function (res) {
|
const req = httplib.request(options, function (res) {
|
||||||
const hasExpectedCode = res.statusCode === expectedCode;
|
const hasExpectedCode = res.statusCode === expectedCode;
|
||||||
var result = '';
|
var result = '';
|
||||||
res.setEncoding('utf8');
|
res.setEncoding('utf8');
|
||||||
|
Loading…
Reference in New Issue
Block a user