Throw an error if user is using XMLHttpRequest

Following changes from @jdalrymple in his `jobs-pipeline-endpoints` branch
This commit is contained in:
Isaac Ouellet Therrien 2018-05-03 10:56:10 -04:00
parent adc1985457
commit 61313ebc21

View File

@ -32,6 +32,9 @@ function defaultRequest(
class RequestHelper {
static async get(service, endpoint, options = {}, requestOptions = {}) {
if (requestOptions && requestOptions.stream === true) {
if (service.useXMLHttpRequest) {
throw new Error('Cannot use streaming functionality with XMLHttpRequest. Please instantiate without this option to use streaming');
}
return StreamableRequest.get(defaultRequest(service, endpoint, {
headers: service.headers,
qs: options,