From 516660ae3f3f62c0ac3147e9b19a5837ef314001 Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Fri, 23 Sep 2022 17:03:29 +0200 Subject: [PATCH] Fix/revert browser field (#115) * fix: remove browser field * fix: do not emit error for 304 --- package.json | 1 - src/index.ts | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9e77162..6003a4d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "A browser client that can be used together with the unleash-proxy.", "main": "./build/index.js", "types": "./build/index.d.ts", - "browser": "./build/main.min.js", "files": [ "build", "examples", diff --git a/src/index.ts b/src/index.ts index a121d36..1e32a6a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -368,9 +368,14 @@ export class UnleashClient extends TinyEmitter { this.emit(EVENTS.READY); this.readyEventEmitted = true; } - } else if (!response.ok) { - console.error('Unleash: Fetching feature toggles did not have an ok response'); - this.emit(EVENTS.ERROR, { type: 'HttpError', code: response.status }) + } else if (!response.ok && response.status !== 304) { + console.error( + 'Unleash: Fetching feature toggles did not have an ok response' + ); + this.emit(EVENTS.ERROR, { + type: 'HttpError', + code: response.status, + }); } } catch (e) { console.error('Unleash: unable to fetch feature toggles', e);