From b17aa4b6a039b94d31b5ea446f3b90780f94b0fa Mon Sep 17 00:00:00 2001 From: Greger Lindblom Date: Wed, 4 Oct 2017 19:17:50 +0200 Subject: [PATCH] change addToWatchlist() request method The endpoint 'WATCHLISTS_ADD_PATH' only supports 'PUT' and 'DELETE'. --- lib/index.js | 2 +- tests/index.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index c88a856..e34ef29 100644 --- a/lib/index.js +++ b/lib/index.js @@ -383,7 +383,7 @@ class Avanza extends EventEmitter { const path = constants.paths.WATCHLISTS_ADD_PATH .replace('{0}', watchlistId) .replace('{1}', instrumentId) - return this.call('GET', path) + return this.call('PUT', path) } /** diff --git a/tests/index.test.js b/tests/index.test.js index dd64d59..91380ef 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -64,7 +64,7 @@ test('addToWatchlist()', async (t) => { .replace('{0}', '54321') const actual = t.context.call.args[0] - const expected = ['GET', expectedPath] + const expected = ['PUT', expectedPath] t.deepEqual(actual, expected) })