From e1ce570214dca7403b7706c15db812f9ecd1af8a Mon Sep 17 00:00:00 2001 From: Dylan Fiedler Date: Sun, 3 Nov 2024 19:37:09 -0600 Subject: [PATCH] fix(observe): set `Accept-Encoding` header when fetching arns data Gateways may use CDNs to serve data. Those CDN's may return compressed data depending on their configuration. To avoid discrpencies, the observations should request the raw data using the `Accept-Encoding: identity` header. Related PR: https://github.com/ar-io/ar-io-observer/pull/53 --- src/utils/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/index.ts b/src/utils/index.ts index 78c13b25..a755c969 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -104,6 +104,10 @@ export const fetchWithTimeout = async (resource:string, options?:RequestInit, ti const response = await fetch(resource, { ...options, + headers: { + ...options?.headers, + 'Accept-Encoding': 'identity' + }, signal: controller.signal }); clearTimeout(id);