From 7ac13b2045fbbe35b21092ad6c7136f85afe4172 Mon Sep 17 00:00:00 2001 From: michielmulders Date: Tue, 15 Aug 2017 21:23:34 +0200 Subject: [PATCH] Issue 50: remove onlyJsonResponse connection.js --- src/connection.js | 7 ++----- src/request.js | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/connection.js b/src/connection.js index d7de2cb..48f387a 100644 --- a/src/connection.js +++ b/src/connection.js @@ -89,9 +89,8 @@ export default class Connection { * @public * @param publicKey * @param spent - * @param onlyJsonResponse */ - listOutputs(publicKey, spent, onlyJsonResponse = true) { + listOutputs(publicKey, spent) { const query = { public_key: publicKey } @@ -102,7 +101,7 @@ export default class Connection { } return this._req(this.getApiUrls('outputs'), { query - }, onlyJsonResponse) + }) } /** @@ -159,7 +158,6 @@ export default class Connection { /** * @public - * * @param transaction */ postTransaction(transaction) { @@ -172,7 +170,6 @@ export default class Connection { /** * @public - * * @param search */ searchAssets(search) { diff --git a/src/request.js b/src/request.js index f768ce2..6d98843 100644 --- a/src/request.js +++ b/src/request.js @@ -12,7 +12,7 @@ const DEFAULT_REQUEST_CONFIG = { * Small wrapper around js-utility-belt's request that provides url resolving, * default settings, and response handling. */ -export default function request(url, config = {}, onlyJsonResponse = true) { +export default function request(url, config = {}) { // Load default fetch configuration and remove any falsy query parameters const requestConfig = Object.assign({}, DEFAULT_REQUEST_CONFIG, config, { query: config.query && sanitize(config.query) @@ -30,7 +30,7 @@ export default function request(url, config = {}, onlyJsonResponse = true) { } return baseRequest(apiUrl, requestConfig) - .then(res => (onlyJsonResponse ? res.json() : { json: res.json(), url: res.url })) + .then(res => (res.json())) .catch(err => { console.error(err) throw err