Skip to content

String response causes TypeError in getEvents #45

Open
@itsfolf

Description

@itsfolf

I am not entirely sure how, but it seems to be possible for the axios res.data to be a string, despite the content-type being correctly set to json, causing the snippet below to error with TypeError: n.forEach is not a function. This happens with both aw-server and aw-server-rust, and only in Firefox.

const events = await this._get("/0/buckets/" + bucketId + "/events", {
params,
});
events.forEach((event: IEvent) => {
event.timestamp = new Date(event.timestamp);
});

private async _get(endpoint: string, params: object = {}) {
return this.req
.get(endpoint, { ...params, signal: this.controller.signal })
.then((res) => (res && res.data) || res);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions