mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 17:50:09 +01:00
Issue 50: remove onlyJsonResponse connection.js
This commit is contained in:
parent
fee4530d5c
commit
d05f7ef3e6
@ -89,9 +89,8 @@ export default class Connection {
|
|||||||
* @public
|
* @public
|
||||||
* @param publicKey
|
* @param publicKey
|
||||||
* @param spent
|
* @param spent
|
||||||
* @param onlyJsonResponse
|
|
||||||
*/
|
*/
|
||||||
listOutputs(publicKey, spent, onlyJsonResponse = true) {
|
listOutputs(publicKey, spent) {
|
||||||
const query = {
|
const query = {
|
||||||
public_key: publicKey
|
public_key: publicKey
|
||||||
}
|
}
|
||||||
@ -102,7 +101,7 @@ export default class Connection {
|
|||||||
}
|
}
|
||||||
return this._req(this.getApiUrls('outputs'), {
|
return this._req(this.getApiUrls('outputs'), {
|
||||||
query
|
query
|
||||||
}, onlyJsonResponse)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +158,6 @@ export default class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*
|
|
||||||
* @param transaction
|
* @param transaction
|
||||||
*/
|
*/
|
||||||
postTransaction(transaction) {
|
postTransaction(transaction) {
|
||||||
@ -172,7 +170,6 @@ export default class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*
|
|
||||||
* @param search
|
* @param search
|
||||||
*/
|
*/
|
||||||
searchAssets(search) {
|
searchAssets(search) {
|
||||||
|
@ -12,7 +12,7 @@ const DEFAULT_REQUEST_CONFIG = {
|
|||||||
* Small wrapper around js-utility-belt's request that provides url resolving,
|
* Small wrapper around js-utility-belt's request that provides url resolving,
|
||||||
* default settings, and response handling.
|
* 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
|
// Load default fetch configuration and remove any falsy query parameters
|
||||||
const requestConfig = Object.assign({}, DEFAULT_REQUEST_CONFIG, config, {
|
const requestConfig = Object.assign({}, DEFAULT_REQUEST_CONFIG, config, {
|
||||||
query: config.query && sanitize(config.query)
|
query: config.query && sanitize(config.query)
|
||||||
@ -30,7 +30,7 @@ export default function request(url, config = {}, onlyJsonResponse = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return baseRequest(apiUrl, requestConfig)
|
return baseRequest(apiUrl, requestConfig)
|
||||||
.then(res => (onlyJsonResponse ? res.json() : { json: res.json(), url: res.url }))
|
.then(res => (res.json()))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
throw err
|
throw err
|
||||||
|
Loading…
Reference in New Issue
Block a user