|
@@ -1,7 +1,23 @@
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
// Sanity-check the conversion and remove this comment.
|
|
// Sanity-check the conversion and remove this comment.
|
|
|
const BASE_URL = `http://${process.env['HTTP_TEST_HOST'] || 'localhost'}:3000`
|
|
const BASE_URL = `http://${process.env['HTTP_TEST_HOST'] || 'localhost'}:3000`
|
|
|
-module.exports = require('request').defaults({
|
|
|
|
|
|
|
+const request = require('request').defaults({
|
|
|
baseUrl: BASE_URL,
|
|
baseUrl: BASE_URL,
|
|
|
followRedirect: false
|
|
followRedirect: false
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+module.exports = request
|
|
|
|
|
+
|
|
|
|
|
+module.exports.promises = {
|
|
|
|
|
+ request: function(options) {
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ request(options, (err, response) => {
|
|
|
|
|
+ if (err) {
|
|
|
|
|
+ reject(err)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resolve(response)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+}
|