Created
June 26, 2023 21:25
-
-
Save kiliman/70ccdf34894db0650aee4eed4bf2df98 to your computer and use it in GitHub Desktop.
Patch to add header to client-side requests in Remix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/@remix-run/react/dist/data.js b/node_modules/@remix-run/react/dist/data.js | |
index b3b935f..58a4874 100644 | |
--- a/node_modules/@remix-run/react/dist/data.js | |
+++ b/node_modules/@remix-run/react/dist/data.js | |
@@ -61,6 +61,12 @@ async function fetchData(request, routeId, retry = 0) { | |
init.body = await request.formData(); | |
} | |
} | |
+ init.headers = { | |
+ ...init.headers, | |
+ ...{ | |
+ "X-Remix-Test": "test" | |
+ } | |
+ }; | |
if (retry > 0) { | |
// Retry up to 3 times waiting 50, 250, 1250 ms | |
// between retries for a total of 1550 ms before giving up. | |
diff --git a/node_modules/@remix-run/react/dist/esm/data.js b/node_modules/@remix-run/react/dist/esm/data.js | |
index 2727874..0e594e2 100644 | |
--- a/node_modules/@remix-run/react/dist/esm/data.js | |
+++ b/node_modules/@remix-run/react/dist/esm/data.js | |
@@ -57,6 +57,12 @@ async function fetchData(request, routeId, retry = 0) { | |
init.body = await request.formData(); | |
} | |
} | |
+ init.headers = { | |
+ ...init.headers, | |
+ ...{ | |
+ "X-Remix-Test": "test" | |
+ } | |
+ }; | |
if (retry > 0) { | |
// Retry up to 3 times waiting 50, 250, 1250 ms | |
// between retries for a total of 1550 ms before giving up. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment