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

Commit

Permalink
(Closes #2) fix browser version
Browse files Browse the repository at this point in the history
  • Loading branch information
jprichardson committed Apr 8, 2016
1 parent 47147a5 commit 6c820f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/shapeshift.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
var xhr = require('xhr')

function get (url, callback) {
xhr({ method: 'GET', url: url, json: true, timeout: 30000 }, function (err, resp, body) {
xhr({ method: 'GET', url: url, json: undefined, timeout: 30000 }, function (err, resp, body) {
if (err) return callback(err)
if (resp.statusCode !== 200) return callback(new Error('HTTP status code: ' + resp.statusCode))
callback(null, body)
})
}

function post (url, data, callback) {
xhr({ method: 'GET', url: url, json: true, timeout: 30000, data: data }, function (err, resp, body) {
xhr({ method: 'POST', url: url, json: data, timeout: 30000 }, function (err, resp, body) {
if (err) return callback(err)
if (resp.statusCode !== 200) return callback(new Error('HTTP status code: ' + resp.statusCode))
callback(null, body)
Expand Down
4 changes: 2 additions & 2 deletions lib/http/http-browser.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
var xhr = require('xhr')

function get (url, callback) {
xhr({ method: 'GET', url: url, json: true, timeout: 30000 }, function (err, resp, body) {
xhr({ method: 'GET', url: url, json: undefined, timeout: 30000 }, function (err, resp, body) {
if (err) return callback(err)
if (resp.statusCode !== 200) return callback(new Error('HTTP status code: ' + resp.statusCode))
callback(null, body)
})
}

function post (url, data, callback) {
xhr({ method: 'GET', url: url, json: true, timeout: 30000, data: data }, function (err, resp, body) {
xhr({ method: 'POST', url: url, json: data, timeout: 30000 }, function (err, resp, body) {
if (err) return callback(err)
if (resp.statusCode !== 200) return callback(new Error('HTTP status code: ' + resp.statusCode))
callback(null, body)
Expand Down

0 comments on commit 6c820f7

Please sign in to comment.