Skip to content

Using angularHttpClient cause Fetch error: #327

@niklaskappler

Description

@niklaskappler

When initializing flagsmith with an angular httpClient, it causes fetch error "Fetch error: [object Object]"

private readonnly httpClient = inject(HttpClient);

flagsmith.init({
    environmentID: 'XXXXXXXXXX',
    onChange: () => {},
    angularHttpClient: this.http
  })

This is due the case that in the getJSON we check the response status number code for in between 200 and 300 (see flagsmith-core.ts#L869C1-L870C1). The angular fetch utils which builds the response object in case using the angular http client does not have any numeric status property. (see angular-fetch.ts#L10)

Verified in version 8.0.3 and back until 3.24.0.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions