function setOptions(options, xhr) {
    const parsedOptions = typeof options === 'string' ? JSON.parse(options) : options;
    for (const prop in parsedOptions) {
      if (prop === 'headers') {
        const headers = parsedOptions['headers'];
        for (const header in headers) {
          xhr.setRequestHeader(header, headers[header]);
        }
      }
      else {
        xhr[prop] = parsedOptions[prop];
      }
    }
  }
@param {object} options - options to set on the xhr
@param {object} xhr - the xhr object