From 7ff3313d9b2adb27d36049d6d2991f1e3c94a923 Mon Sep 17 00:00:00 2001 From: Callum Loh Date: Fri, 27 Sep 2024 16:12:59 +0100 Subject: [PATCH] fix: also trigger postbody function on non esi responses --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index 4adff49..40625ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -184,6 +184,10 @@ export class esi { const resp = new Response(response.body, response); // We set the URL manually here as it doesn't come across from the copy˛ Object.defineProperty(resp, "url", { value: response.url }); + // process postBody function if relevant + if (this.postBodyFunction) { + this.postBodyFunction(); + } return resp; }