Skip to content

Commit

Permalink
Merge pull request #89 from michielmulders/removeOnlyJsonResponse to …
Browse files Browse the repository at this point in the history
…solve issue 50

Issue 50: remove onlyJsonResponse from connection.js
  • Loading branch information
michielmulders committed Aug 21, 2017
2 parents e4267ee + 8bf61b9 commit 88c2d37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -102,7 +101,7 @@ export default class Connection {
}
return this._req(this.getApiUrls('outputs'), {
query
}, onlyJsonResponse)
})
}

/**
Expand Down Expand Up @@ -159,7 +158,6 @@ export default class Connection {

/**
* @public
*
* @param transaction
*/
postTransaction(transaction) {
Expand All @@ -172,7 +170,6 @@ export default class Connection {

/**
* @public
*
* @param search
*/
searchAssets(search) {
Expand Down
4 changes: 2 additions & 2 deletions src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 88c2d37

Please sign in to comment.