text: import { BadResponseError } from "./Errors/ServerErrors/BadResponseError";
  import { Header } from "./Header";
  var Response = (function () {
      function Response(request, data, response) {
          this.request = request;
          if (typeof XMLHttpRequest !== "undefined" && request instanceof XMLHttpRequest) {
              this.status = request.status;
              this.data = request.responseText;
              this.headers = Header.parseHeaders(request.getAllResponseHeaders());
          }
          else {
              this.data = data || "";
              this.status = response && response.statusCode || 0;
              this.headers = new Map();
              if (!response)
                  return;
              for (var name_1 in response.headers) {
                  var header = new Header(response.headers[name_1]);
                  this.headers.set(name_1.toLowerCase(), header);
              }
          }
      }
      Response.prototype.getHeader = function (name) {
          name = name.toLowerCase();
          return this.headers.get(name) || null;
      };
      Response.prototype.getETag = function () {
          var eTagHeader = this.getHeader("ETag");
          if (!eTagHeader || !eTagHeader.values.length)
              throw new BadResponseError("The response doesn't contain an ETag", this);
          return eTagHeader.values[0];
      };
      return Response;
  }());
  export { Response };
  
  //# sourceMappingURL=Response.js.map
  