Skip to content

chore(release): 2.1.2 #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/optimizely-sdk/CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2.1.2
June 25, 2018

* Fix: Failure to log success message when event dispatched ([#123](https://github.com/optimizely/javascript-sdk/pull/123))
* Fix: Don't call success message when event fails to send ([#123](https://github.com/optimizely/javascript-sdk/pull/123))

## 2.0.5
June 25, 2018

* Fix: Failure to log success message when event dispatched ([#123](https://github.com/optimizely/javascript-sdk/pull/123))
* Fix: Don't call success message when event fails to send ([#123](https://github.com/optimizely/javascript-sdk/pull/123))

## 2.1.1
June 19, 2018

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = {
dispatchEvent: function(eventObj, callback) {
// Non-POST requests not supported
if (eventObj.httpVerb !== 'POST') {
callback(new Error('httpVerb not supported: ' + eventObj.httpVerb));
return;
}

Expand All @@ -52,13 +51,15 @@ module.exports = {
}
};

var requestCallback = function(error, response, body) {
if (response && response.statusCode && response.statusCode >= 200 && response.statusCode < 400 && callback && typeof callback === 'function') {
callback();
var requestCallback = function(response) {
if (response && response.statusCode && response.statusCode >= 200 && response.statusCode < 400) {
callback(response);
}
};

var req = (parsedUrl.protocol === 'http:' ? http : https).request(requestOptions, requestCallback);
// Add no-op error listener to prevent this from throwing
req.on('error', function() {});
req.write(dataString);
req.end();
return req;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ describe('lib/plugins/event_dispatcher/node', function() {
httpVerb: 'POST',
};

eventDispatcher.dispatchEvent(eventObj)
.on('response', function(response) {
assert.isTrue(response.statusCode === 200);
eventDispatcher.dispatchEvent(eventObj, function(resp) {
assert.equal(200, resp.statusCode);
done();
})
.on('error', function(error) {
assert.fail('status code okay', 'status code not okay', '');
});
});

Expand All @@ -70,15 +66,15 @@ describe('lib/plugins/event_dispatcher/node', function() {

eventDispatcher.dispatchEvent(eventObj, stubCallback.callback)
.on('response', function(response) {
done();
sinon.assert.calledOnce(stubCallback.callback);
done();
})
.on('error', function(error) {
assert.fail('status code okay', 'status code not okay', '');
});
});

it('rejects GET httpVerb', function(done) {
it('rejects GET httpVerb', function() {
var eventObj = {
url: 'https://cdn.com/event',
params: {
Expand All @@ -87,16 +83,22 @@ describe('lib/plugins/event_dispatcher/node', function() {
httpVerb: 'GET',
};

var callback = function(err) {
if (err) {
done();
} else {
done(new Error('expected error not thrown'));
}
};

var callback = sinon.spy();
eventDispatcher.dispatchEvent(eventObj, callback);
sinon.assert.notCalled(callback);
});
});

it('does not throw in the event of an error', function() {
var eventObj = {
url: 'https://example',
params: {},
httpVerb: 'POST',
};

var callback = sinon.spy();
eventDispatcher.dispatchEvent(eventObj, callback);
sinon.assert.notCalled(callback);
});
});
});
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/lib/utils/enums/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ exports.CONTROL_ATTRIBUTES = {

exports.JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk';
exports.NODE_CLIENT_ENGINE = 'node-sdk';
exports.NODE_CLIENT_VERSION = '2.1.1';
exports.NODE_CLIENT_VERSION = '2.1.2';

/*
* Notification types for use with NotificationCenter
Expand Down
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/optimizely-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@optimizely/optimizely-sdk",
"version": "2.1.1",
"version": "2.1.2",
"description": "JavaScript SDK package for Optimizely X Full Stack",
"main": "dist/optimizely.node.js",
"browser": "lib/index.browser.js",
Expand Down