Skip to content
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

Update API endoint paths for Unleash 3.x #56

Merged
merged 3 commits into from
Jan 18, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

* Swhich hashing to MurmurHash (https://github.com/Unleash/unleash/issues/247)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but Swhich/Switch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix directly on master.

* Bugfix RemoteAddressStrategy (https://github.com/Unleash/unleash-client-node/issues/65)
* Update client paths for v3 (https://github.com/Unleash/unleash-client-node/issues/50)

## 2.3.1

* Add sdkVersion in client register call (https://github.com/Unleash/unleash-client-node/issues/49)
* IP range support to remoteAddress-strategy
(https://github.com/Unleash/unleash-client-node/pull/58)

- Update API endoint paths for Unleash 3.x
(https://github.com/Unleash/unleash-client-node/issues/50)

## 2.3.0

* Add support for custom headers
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
This is the node client for Unleash. Read more about the
[Unleash project](https://github.com/finn-no/unleash)

**Version 3.x of the client requires `unleash-server` v3.x or higher.**

## Getting started

### 1. Initialize unleash-client
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unleash-client",
"version": "2.3.1",
"version": "3.0.0",
"description": "Unleash Client for Node",
"license": "Apache-2.0",
"main": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class Repository extends EventEmitter implements EventEmitter {
}

fetch() {
const url = resolve(this.url, './features');
const url = resolve(this.url, './client/features');
get(
{
url,
Expand Down
2 changes: 1 addition & 1 deletion test/global.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let counter = 0;
function mockNetwork(toggles = defaultToggles) {
const url = `http://unleash-${counter++}.app`;
nock(url)
.get('/features')
.get('/client/features')
.reply(200, { features: toggles });
return url;
}
Expand Down
12 changes: 6 additions & 6 deletions test/repository.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MockStorage extends EventEmitter {
function setup(url, toggles, headers = {}) {
return nock(url)
.persist()
.get('/features')
.get('/client/features')
.reply(200, { features: toggles }, headers);
}

Expand Down Expand Up @@ -115,7 +115,7 @@ test.cb('should request with etag', t => {
nock(url)
.matchHeader('If-None-Match', value => value === '12345-1')
.persist()
.get('/features')
.get('/client/features')
.reply(200, { features: [] }, { Etag: '12345-2' });

const repo = new Repository({
Expand All @@ -141,7 +141,7 @@ test.cb('should request with custom headers', t => {
nock(url)
.matchHeader('randomKey', value => value === randomKey)
.persist()
.get('/features')
.get('/client/features')
.reply(200, { features: [] }, { Etag: '12345-3' });

const repo = new Repository({
Expand All @@ -168,7 +168,7 @@ test.cb('should handle 404 request error and emit error event', t => {
const url = 'http://unleash-test-5.app';
nock(url)
.persist()
.get('/features')
.get('/client/features')
.reply(404, 'asd');

const repo = new Repository({
Expand All @@ -194,7 +194,7 @@ test('should handle 304 as silent ok', t => {
const url = 'http://unleash-test-6.app';
nock(url)
.persist()
.get('/features')
.get('/client/features')
.reply(304, '');

const repo = new Repository({
Expand All @@ -216,7 +216,7 @@ test('should handle invalid JSON response', t =>
const url = 'http://unleash-test-7.app';
nock(url)
.persist()
.get('/features')
.get('/client/features')
.reply(200, '{"Invalid payload');

const repo = new Repository({
Expand Down
4 changes: 2 additions & 2 deletions test/unleash.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const defaultToggles = [
];
function mockNetwork(toggles = defaultToggles, url = getUrl()) {
nock(url)
.get('/features')
.get('/client/features')
.reply(200, { features: toggles });
return url;
}
Expand Down Expand Up @@ -122,7 +122,7 @@ test('should re-emit events from repository and metrics', t => {
test.cb('repository should surface error when invalid basePath', t => {
const url = 'http://unleash-surface.app/';
nock(url)
.get('/features')
.get('/client/features')
.delay(100)
.reply(200, { features: [] });
const backupPath = join(tmpdir(), `test-tmp-${Math.round(Math.random() * 100000)}`);
Expand Down