Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2621 from brave/ledger-fetch
Browse files Browse the repository at this point in the history
changes required for brave/muon#29
  • Loading branch information
bbondy authored Jul 21, 2016
2 parents 4dc2b45 + 722552c commit 38b0bf8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports.request = (url, callback) => {
if (!defaultSession) {
callback(new Error('Request failed, no session available'))
} else {
defaultSession.webRequest.fetch(url, 'get', {}, (statusCode, responseBody, headers) => {
callback(null, statusCode, responseBody)
defaultSession.webRequest.fetch(url, (err, response, responseBody) => {
callback(err, response.statusCode, responseBody)
})
}
}
Expand All @@ -28,11 +28,11 @@ module.exports.requestDataFile = (url, headers, path, reject, resolve) => {
if (!defaultSession) {
reject('Request failed, no session available')
} else {
defaultSession.webRequest.fetch(url, 'get', headers, path, (statusCode, responseBody, headers) => {
if (statusCode === 200) {
defaultSession.webRequest.fetch(url, { headers, path }, (err, response) => {
if (!err && response.statusCode === 200) {
resolve(headers['etag'])
} else if (statusCode !== 200) {
reject(`Got HTTP status code ${statusCode}`)
} else {
reject(`Got HTTP status code ${response.statusCode}`)
}
})
}
Expand Down

0 comments on commit 38b0bf8

Please sign in to comment.