Caching a brotli encoded response in KV from a Worker
Hello o/
I am trying to create a proxy with my worker which would just fetch the original url on first call, then cache the response. Until the cache gets hit, that worker would just send a reponse which is the cached value.
I am blocking on the "saving in cache" part as I noticed that the reponse I'm getting from the database API (supabase) is encoded in brotli.
Here is my code:
I think that the problem is that this response is encoded and therefore
dataText
is unreadable. I tried .json()
instead as the response has json type but it fails even harder.
Does anyone have an idea of what I'm doing wrong, what I'm not understanding or just any thing you'd like me to test and see if it helps?
Thanks a lot ❤️0 Replies