overleaf/services/web/test/acceptance/src/helpers/request.js
Hugh O'Brien a319073a08 Merge pull request #2132 from overleaf/spd-collabratec-tests
Make collabratec tests not depend on previous run state

GitOrigin-RevId: 264f946e05b848fa253b6fbdd8e97a4998e4158e
2019-09-10 10:08:59 +00:00

23 lines
576 B
JavaScript

// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
const BASE_URL = `http://${process.env['HTTP_TEST_HOST'] || 'localhost'}:3000`
const request = require('request').defaults({
baseUrl: BASE_URL,
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)
}
})
})
}
}