constructor()

in authui-container/src/utils/http-client.ts [215:237]


  constructor(resp: LowLevelResponse) {
    this.status = resp.status;
    this.headers = resp.headers;
    this.request = resp.request;
    if (Math.floor(this.status / 100) * 100 !== 200) {
      throw createLowLevelError(
        `Server responded with status ${resp.status}`,
        resp.status, resp.config, resp.request, resp);
    }
    if (isObject(resp.data)) {
      this.parsedData = resp.data;
      this.text = JSON.stringify(resp.data);
    } else {
      this.text = resp.data as string;
    }

    // The underlying data (JSON or text) returned from the remote server.
    if (this.isJson()) {
      addReadonlyGetter(this, 'data', this.parsedData);
    } else {
      addReadonlyGetter(this, 'data', this.text);
    }
  }