code: function getResponseContentType(response) {
      let contentType;
      if (response.getResponseHeader) {
          // XMLHttpRequest provides getResponseHeader
          contentType = response.getResponseHeader("Content-Type");
      } else if (response.headers) {
          // request provides http.IncomingMessage which has a message.headers map
          contentType = response.headers['content-type'] || null;
      }
  
      if (!contentType) {
          return null;
      }
  
      try {
          return parseContentType(contentType);
      } catch(e) {
          throw new Error(`Error parsing Content-Type '${contentType}': ${e}`);
      }
  }
docs: extract the Content-Type header from the response object, and
  parse it to a `{type, parameters}` object.
  
  returns null if no content-type header could be found.
  
  @param {XMLHttpRequest|http.IncomingMessage} response response object
  @returns {{type: String, parameters: Object}?} parsed content-type header, or null if not found